.NET Samples - How To: Reflection

This section includes the following samples:

ListMembers Sample

Invoke Sample

GetTypes Sample

ListMembers Sample

This sample lets you list the members for a given data type.

Namespaces used in this sample:

System; System.Drawing; System.Reflection

Classes used in this sample:

Binding; Instance; ListItem; Header; CheckBox; Type; DropDownList; EventArgs; Font; Import; MemberInfo; Object; String; FieldInfo; TextBox; Style; Label; PropertyInfo; ConstructorInfo; Table; EventInfo; MethodInfo; Array

Invoke Sample

This sample illustrates how to invoke different kinds of methods through reflection.

Namespaces used in this sample:

System; System.IO; System.Reflection

Classes used in this sample:

Console; Binding; String; Object; Type; Import; StringWriter; Instance; DefaultMemberAttribute; MemberInfo; EventArgs; Page; Attribute; MethodInfo

GetTypes Sample

This sample illustrates how to retrieve all the types for a given assembly.

Namespaces used in this sample:

System; System.IO; System.Reflection

Classes used in this sample:

Console; Type; Types; Array; Assembly; Object; ValueType; String; Import; StringWriter; Module; Page; Exception; EventArgs