Reflection In C#
Today i Am going to Demonstrate Something About Reflection.
Reflection is a Technique through we get the internal Details of Application Without having the Access To the Source code.
Here i m Providing You Code Snippet That give the Class And MethodsUse In the Assembly.
first You Have To Include Reflection namespace in Your Application.
using System;
using System.Reflection;
now load Assembly by using this code
Assembly objAssembly=Assembly.LoadFrom(string AssemblyName);
Get All the Types use in Assembly
Type [] types=objAssembly.GetTypes();
now To Detemine Whether the Type is Class or method or Inteface Use the Code Below
foreach(Type t in types)
{
if(t.isClass)
{
Console.WriteLine("Class Name"+t.FullName);
}
}
you can use Different Properties to find out Methods,interface or class Information.. etc..