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)
Console.WriteLine("Class Name"+t.FullName);

you can use Different Properties to find out Methods,interface or class Information.. etc..


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: