Reflection provides objects (of type Type) that encapsulate assemblies, modules and types. You can use reflection to dynamically create an instance of a type, bind the type to an existing object, or get the type from an existing object and invoke its methods or access its fields and properties. If you are using attributes in your code, Reflection enables you to access them. For more information, see Attributes.
For example, if you want to programmatically display all the methods of a class, you could do it like so:
using System;
using System.Reflection;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var t = typeof(MyClass);
foreach (var m in t.GetMethods())
{
Console.WriteLine(m.Name);
}
Console.ReadLine();
}
}
public class MyClass
{
public int Add(int x, int y)
{
return x + y;
}
public int Subtract(int x, int y)
{
return x - y;
}
}
}
For More Information You Can Refer The Link :
Reflection in .NET[
^]