Loading ...

Reflection in Action | .net Java | CodeAsp.Net

Reflection in Action | .net Java

 /5
0 (0votes)

Hi, 

    I am writing this blog because, Reflection provides higher level abstraction, actually using reflection we can examine the object and handle that object at run time as per our requirement.

   For example, just before some time using reflection i am searching parent of the current object, and used that information for error logging purpose.

objMethodBase = system.reflection.methodbase; 

 

 

ParentclassName= ((System.Reflection.

MemberInfo)(((System.Reflection.MemberInfo

)(objMethodBase)).DeclaringType)).Name.ToString();

 

 

 

This line will return you, parent class of current object.

   So we can say, using reflection can minimize maintenance as the same code.

 

Comments (no comments yet)

Top Posts