[C#] Reflection: getting calling method

Soldato
Joined
12 Apr 2004
Posts
11,788
Location
Somewhere
Is it possible to get the object under which the calling method was called?

So far, I have the following code:
Code:
StackFrame stack = new StackFrame(1);
MethodBase method = stack.GetMethod();
if (!method.IsStatic)
{
    //method.DeclaringType;
}
However, what I want is to be able to obtain a reference to the method's parent object, not just the type that declares it.
 
Back
Top Bottom