The code snippet explains how to use the concept of REFLECTION

The code snippet explains how to use the concept of REFLECTION

What is Reflection?

All .net assemblies have metadata info stored about the types defined in modules .This metadata information can be accessed by mechanism called Reflection.

Let us see by example how this concept can be done


In we are using windows application .Using listcontrol we can list all the methods

Namesapces to be used:

Imports System.Reflection

Form1.vb source code:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim pobjtype As Type
Dim pobjobj As Object

Dim b As New Button
pobjtype = b.GetType()

For Each pobjobj In pobjtype.GetMembers
End Sub
End Class


In c# we are using the console application to list methods

Namespaces to be used

using System.Windows.Forms;
using System.Reflection;

cs source file

namespace ConsoleApplication35

class Program:Form

static void Main(string[] args)

Type objtype;
Button b=new Button ();
objtype = b.GetType();
foreach (object obj in objtype.GetMembers())




No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: