What is reflection, DOT NET Programming

Assignment Help:

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

 


Related Discussions:- What is reflection

Develop a iphone and android mobile game, Develop a iPhone and Android mobi...

Develop a iPhone and Android mobile game Project Description: I am seeking a developer to create a mobile game for me. I need an endless runner game with simple controls. The

What is lazy initialization, What is lazy initialization? Lazy initiali...

What is lazy initialization? Lazy initialization is a process by which an object is not initialized until it is first called in your code. The .NET 4.0 introduces a new wrapper

What is .net framework, C# Programming 1. What is .Net Framework? 2....

C# Programming 1. What is .Net Framework? 2. Write short notes on constructors and destructors. 3. Explain boxing and unboxing with examples. 4. What is a mixed mode a

Define cts, CTS(Common Type System) : In order that the two language commu...

CTS(Common Type System) : In order that the two language communicate smoothly CLR has CTS (Common Type System). Example in VB you have "Integer" and in C++ you have "long" these d

Need experienced dot net and php programmers, Need Experienced dot Net and ...

Need Experienced dot Net and PHP Programmers Project Description: Need Experienced dot Net., JSP, PHP, Java Programmers Skilled professional and command in Programming eit

Component diagrams, Explain Component diagrams Package: - The Pa...

Explain Component diagrams Package: - The Package logically make group of element of a UML model. Component: - It is the actual physical module or implementation of

Xml reader class, What is an XMLReader Class? This is an abstract class...

What is an XMLReader Class? This is an abstract class available from the System.XML namespace. The XML reader works on a read-only stream browsing from one node to another in a

File upload in asp.net, upload files using file upload control to google dr...

upload files using file upload control to google drive

C# Microsoft Solver Foundation, I have a code in C# which uses Microsoft So...

I have a code in C# which uses Microsoft Solver Foundation to solve linear programming model. But the problem is the code is too long, there are too many variables and constraints,

Learning management system, I am looking for learning management software (...

I am looking for learning management software (LMS) preferably in ASP.NET and Microsoft SQL/ MYSQL server as the database. The broad scope of the system could be 1. User managem

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd