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
What is the difference amonga system workflow and a human workflow? A system workflow is a workflow that is developed to automate interactions between applications. Such workfl

The only difference is that I need the most new version. Things have changed a little since then (the key has), so I need this done freshly. I require the result in C#, sourceco

Normal 0 false false false EN-IN X-NONE X-NONE MicrosoftInternetExplorer4

What is the difference between Class and structure's? The main differences between them are as follows:- 1) The Structure is value types while classes are referen

Ask queyuyuystion #Minimum 100 words accepted#

Project Description: We require a Part time or long contract, Programmer/Developer working in Sydney. Task - Write PHP software into asp.net. Develop new software to enhan

Project Description: We are seeking someone who can write a program in C# or C++. The idea is to prepare the program using a Cross Platform environment like Mono or Qt which

How can we get the state of the requested process? XMLHttpRequest get the current state of the request operation by using the readyState property. This property checks the cond

Question: (a) Give four benefits of ASP.NET Web Controls. (b) List and explain any five properties of the ValidationSummary control. (c) Multiple Web Form controls ca

Set up a FTP File Server and active FTP File Transfer using VB.NET The Job Description is as given: 1. Manually set up a FTP file server on a remote server. 2. Manually ad