All .NET assemblies have metadata information stored the types defined in the modules. And This metadata information can be accessed by mechanism called as "Reflection". The System.Reflection is used to browse through the metadata information.By Using the reflection we can also dynamically invoke methods using the System.The Type.InvokeMember. Below is the sample source code if needed we can also get this code from the CD provided, go to the "Source code" folder in the "Reflection Sample" folder.Public Class Form1Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim Pobjtype As Type Dim PobjObject As Object Dim PobjButtons As New Windows.Forms.Button() Pobjtype = PobjButtons.GetType()For Each PobjObject In Pobjtype.GetMembersLstDisplay.Items.Add(PobjObject.ToString())NextEnd SubEnd Class
Sample source code uses reflection to browse through "Button" class of "Windows.Forms". If we compile & run the program following is the output as shown in "Sample Reflection Display". By Using the reflection we can also dynamically invoke a method using "System.Type.Invoke Member".