Friday, August 2, 2019

Reflection in C#

what is Reflection:

Reflection is the ability of a managed code to read its own metadata for the purpose of finding assemblies, modules and type information at runtime.
In other words, reflection provides objects that encapsulate assemblies, modules and types.


It gives the below info at run time:
  • Assembly
  • Module
  • Enum
  • MethodInfo
  • ConstructorInfo
  • MemberInfo
  • ParameterInfo
  • Type
  • FieldInfo
  • EventInfo
  • PropertyInfo



Example:

  1.  int n = 45;  
  2.             //string n = "vineet";  
  3.             System.Type t = n.GetType();






No comments:

Post a Comment