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
Project Description I require a Automated penny auction bidder software (bidder robot, sniper software, Autobidder ) that put bid at specific milliseconds Nanoseconds from the e

Can we run DOT.NET in UNIX platform? One of the drawbacks of using Visual Studio.NET and the .NET framework to develop applications has been the lack of cross-platform support.

Question: (a) Define four special target names use with the TARGET attribute. (b) Assume that you have a document with many subsections. Write the HTML code to create a fr

ASP Programmer I need a fixing all W3c validation errors and it is a ASP website. Have any queries please send a message and I will provide more information on project. De

What is ACID fundamental? What are transactions in SQL SERVER? The transaction is a sequence of operations performed as a single logical unit of work..The logical unit of work

What is a delegate? A delegate is similar to a class that is used for storing the reference to a method and invoking that method at runtime, as needed. A delegate can hold the

I am concerned to doing like this project, i have 5 years of experience in .net skill in engineering and computer related positions with devotement section, I am now a Senior Softw

I need a program that mimics the similar functionality as the link below. Program must have a unique user interface. Must add source code, installer, and of course a nice user i

What is Common Type System (CTS)? CTS is the component of CLR by which .NET Framework provides support for multiple languages because it have a type system that is common acros

What is the relation between Classes and Objects? The class & object look very much same but are not same. The Class is a definition, while object is a instance of the class cr