By Rajadurai .P
This article explains how to make use of System.Reflection class to extract each and every detail of any class in .Net Framework.
The MemberInfo class available in System.Reflection namespace is an abstract class.
It discovers the attributes of a member and provides access to the member metadata.
We need to assign the details we need to query about a type viz. Constructors/Methods/Interfaces/Fields/Property etc. to the MemberInfo class local variable.
For this, We can make use of the methods GetFields/GetMethods/GetInterfaces etc.
In this code example, the user will be prompted to select the class about which he would like to view details.
The details of the class selected (available Methods/Interfaces/Fields) will be listed out in the corresponding listboxes.
To compile, type: csc reflection.cs
Download reflection.cs
Here's what it looks like