1.

Why We Need Reflection In C#?

Answer»

Reflections needed when we want to determine / inspect contents of an assembly. For example: at Visual Studio editor intelligence, when we type “.” (dot) before any object, it gives us all the MEMBERS of the object. This is possible for Reflection.

Beside this we need reflection for the following purposes:

  • To view attribute information at run time
  • To view the STRUCTURE of assemblies at run time (classes, resources, methods)
  • It allows dynamic/late binding to methods and properties
  • In SERIALIZATION, it is used to serialize and de-serialize objects
  • In web service, it is used to create and consume SOAP messages and also to GENERATE WSDL
  • Debugging tools can use reflection to examine the state of an object.

Reflections needed when we want to determine / inspect contents of an assembly. For example: at Visual Studio editor intelligence, when we type “.” (dot) before any object, it gives us all the members of the object. This is possible for Reflection.

Beside this we need reflection for the following purposes:



Discussion

No Comment Found