我不知道如何正确解释我想要的。这是一个例子^
public void foo()
{
StackFrame trace = new StackFrame(1);
MethodBase method = trace.GetMethod(); //so, here we'll get bar-method info
MthodBody body = method.GetMethodBody(); //and here we'll get bar-method body
/*now i need get access to the local vars in bar
i know about MethodBody.LocalVariables
but i don't have any idea how i can get values of variables i and hello,
that defined in bar-method. I think it may be possible if i'll get
pointers to the vars,
and then copy it with Marshal.Copy*/
}
public void bar()
{
int i = 42;
string hello = "Hello!";
foo();
}
PS我希望我的例子并不可怕,你明白我到底想要什么。 PPS对不起,我的英语很糟糕:)