Reflection

10. Reflection

 

Definition:

            We can access some data about object at runtime by using Reflection.

That information contain

·          Data of the class

·          Names of the Methods that are inside the class

·          Constructor of that Object.

To write a C# .Net program this uses reflection,

                        The program should use the namespace System.Reflection.

To get type of the object,

                         The typeof operator can be used.                                

             There is one more method GetType ().

          uses to get data about object’s type

By using Reflection we can do the following

·         Can get all methods from a class

·         Can get all Fields and Properties from a class

·         Can get information about assembly

·         Can create instance for a class

·         Can execute a class method indirectly

·         Can get type information: base type, is abstract, is com object, is sealed, is class

·         Can get all implemented interfaces and inherited base classes 

Advertisements

2 responses

  1. This is good. But i want to know the implementation part in Detail.

    can u please help me?

    1. Hi Prakash,
      Sure, Currently i am working on that.
      most probably within one week i will host that.
      sorry for the delay

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: