Embed presentation
Download to read offline

![REFLECTION
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
namespace pragim
{
public class MainClass
{
static void Main(string[] args)
{
Type T = Type.GetType("pragim.Customer");
Console.WriteLine("Full Name={0}", T.FullName);
Console.WriteLine("Just The Name={0}", T.Name);
Console.WriteLine("Just The Namespace={0}", T.Namespace);
Console.WriteLine();](https://image.slidesharecdn.com/program8-210213171503/85/PROGRAMMING-USING-C-NET-SARASWATHI-RAMALINGAM-2-320.jpg)
![Console.WriteLine("Properties in Customer");
PropertyInfo[] properties = T.GetProperties();
foreach (PropertyInfo property in properties)
{
Console.WriteLine(property.PropertyType.Name+" "+property.Name);
}
Console.WriteLine();
Console.WriteLine("Methods in Customer Class");
MethodInfo[] methods = T.GetMethods();
foreach (MethodInfo method in methods)
{
Console.WriteLine(method.ReturnType.Name + " " +method.Name);
}
Console.WriteLine();
Console.WriteLine("Constructor in Customer Class");
ConstructorInfo[] constructors = T.GetConstructors();
foreach (ConstructorInfo constructor in constructors)
{
Console.WriteLine(constructor.ToString());
}
}
}](https://image.slidesharecdn.com/program8-210213171503/85/PROGRAMMING-USING-C-NET-SARASWATHI-RAMALINGAM-3-320.jpg)



This document provides a lab manual for programming using C# that demonstrates how to use reflection to get information about a Customer class. It defines a Customer class with Id and Name properties and corresponding getter/setter methods, and constructor methods. The Main method uses reflection to get the full name, name, and namespace of the Customer type, then outputs the properties, methods, and constructors defined in the Customer class.

![REFLECTION
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
namespace pragim
{
public class MainClass
{
static void Main(string[] args)
{
Type T = Type.GetType("pragim.Customer");
Console.WriteLine("Full Name={0}", T.FullName);
Console.WriteLine("Just The Name={0}", T.Name);
Console.WriteLine("Just The Namespace={0}", T.Namespace);
Console.WriteLine();](https://image.slidesharecdn.com/program8-210213171503/85/PROGRAMMING-USING-C-NET-SARASWATHI-RAMALINGAM-2-320.jpg)
![Console.WriteLine("Properties in Customer");
PropertyInfo[] properties = T.GetProperties();
foreach (PropertyInfo property in properties)
{
Console.WriteLine(property.PropertyType.Name+" "+property.Name);
}
Console.WriteLine();
Console.WriteLine("Methods in Customer Class");
MethodInfo[] methods = T.GetMethods();
foreach (MethodInfo method in methods)
{
Console.WriteLine(method.ReturnType.Name + " " +method.Name);
}
Console.WriteLine();
Console.WriteLine("Constructor in Customer Class");
ConstructorInfo[] constructors = T.GetConstructors();
foreach (ConstructorInfo constructor in constructors)
{
Console.WriteLine(constructor.ToString());
}
}
}](https://image.slidesharecdn.com/program8-210213171503/85/PROGRAMMING-USING-C-NET-SARASWATHI-RAMALINGAM-3-320.jpg)

