What is reflection: reflecting providing an object (described assemblies, modules and types of Type type). Can be created dynamically using the reflection type of instance, bind to an existing object type, or acquired from an existing object type, and then call its methods or access its fields and properties. If the characteristics of the code used, the reflection can be used to access them. For more information, see characteristics .
Why reflection:
- When a program needs to access the metadata properties. For more information, please refer to the information stored in a retrieval characteristics of .
- Examples of types of inspection and assembly.
- Construction of a new type at run time. Use System.Reflection.Emit classes.
- Late perform binding at runtime to create access method on the type. See the topic " dynamic loading and type of use ."
How to use reflection:
GetType () : Gets the current instance of the Type .
The typeof operator : means for acquiring a type of System.Type instance