What is Reflection?

A feature of attribute-based programming that allows an application to query its own metadata. Reflection allows an application to discover information about itself so that it may display this information to the user, modify its own behavior by using late-binding and dynamic invocation (i.e., binding to and calling methods at runtime), or create new data types at runtime.

Reflection comes from System.reflection for viewing metadata from an assembly. Reflection provides objects 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. You can then invoke the type's methods or access its fields and properties.

For the attributes in the metadata to be useful, we need a way to access them , ideally during runtime. The classes in the Reflection namespace, along with the System.Type and System.TypedReference classes, provide support for examining and interacting with the metadata. Reflection is used for the following tasks:

For more explanations, refer to Oreilly on Reflection