Tuesday, June 16, 2009

What is Reflaction ?

Refelection :

List of class name , method anme

# Refelection is way through which we can identify metadata about assembly runtime.

Exp : We have a .net Assembly file (.dll file ), which cosists of two class definition and 10 method Names. We can get information about classes and methods names through reflaction.

Few Exp Of Reflaction :

# Loading Assembly file

Assembly assem= Assembly.LoadForm(SAssemblyFileName)

# Get the List of Class Name

Type[]types=assem.GetTypes();

------------------------------------------------------------------------

Refliction:

It extend the benifits of maetadata by allowing the developers to ispect and use it at run time.

# For exp: It dynamically detemined all the classes contained in a given assembly and invoke their methos.

# Reflaction Provides objects that encapsulate assemblies, methods and types

# System.Reflaction namespace contain classes that can be used to introgate the types for module/ assemly.

# All .NeT compliers produce metadata about the types defined in the modules they produce. This metadata is package along with the module (modules in the terms are packaged together assemblies) can be accessed by the machinism called reflection.


# You can use reflaction to dynamically create an instance of a type , bind the type to an existing object, or get the type from an existing object.

No comments: