Question - Explain Reflection in C#.
Answer -
The ability of code to access the metadata of the assembly during runtime is called Reflection. A program reflects upon itself and uses the metadata to:
Inform the user, or
Modify the behaviour
The system contains all classes and methods that manage the information of all the loaded types and methods. Reflection namespace. Implementation of reflection is in 2 steps:
- Get the type of the object, then
- Use the type to identify members, such as properties and methods