我有方法
public void SomeMethod(string PersonName,int Age)
{
// get call stack
StackTrace stackTrace = new StackTrace();
// should equal "SomeMethod"
var MethodName = stackTrace.GetFrame(0).GetMethod().Name;
// should be ParameterInfo of parameter "PersonName"
var firstParam = stackTrace.GetFrame(0).GetMethod().GetParameters()[0];
// Here is where I get stuck !!!!!!!
var t = firstParam.GetValue();
我如何能够获得对 firstParam 参数指向的位置的引用以获取它的值?
我知道我可以通过 PersonName 获得该信息,但我想通过 firstParam 检索该信息。