What is reflection, DOT NET Programming

Reflection

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 Form1
Private 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.GetMembers
LstDisplay.Items.Add(PobjObject.ToString())
Next
End Sub
End Class

1506_reflection display.jpg


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".

 

Posted Date: 9/18/2012 7:33:38 AM | Location : United States







Related Discussions:- What is reflection, Assignment Help, Ask Question on What is reflection, Get Answer, Expert's Help, What is reflection Discussions

Write discussion on What is reflection
Your posts are moderated
Related Questions
A few changes to OutloProject Description: We require someone who is familiar with programming plug-in to work with Microsoft Outlook. Initially we just require a simple chan

Print Pyramids of Numbers - C# Program Hello can you please provide me some examples regarding to the Print Pyramids of Numbers in C#.

JIT compiler is the part of the runtime execution environment. In Microsoft .NET there are three types  of JIT compilers are available: 1) Pre-JIT :- The Pre-JIT compiles the co

how to write a postfix expression calculator program using c#

What is semantic gap? Defining a useful channel includes both understanding the applications requirements and recognizing the limitations of the underlying technology. The gap

What is Thread.Join() in threading? There are 2 versions of Thread.Join :- Thread.join(). Thread.join(Integer) this returns a Boolean value. The Thread.Join

write a program in C# to perform arithmetic operation

Task on data mining Project Description: Task on Opinion Mining, Sentiment Analysis Skills required are C# Programming, Software Architecture, Data Mining

Needed Expert Ruby in Rail Deveoloper - urgent Project Description: I require an expert Ruby on Rail developer. Need someone who has depth in knowledge of Ruby on Rail. Wi

What is a delegate? The Delegate is the class that can hold a reference to a method or a function. The Delegate class has a signature and it can only reference to those methods