【发布时间】:2011-02-27 10:36:43
【问题描述】:
我有一个如下所示的类:
public class MyClass
{
...
protected void MyMethod()
{
...
string myName = System.Reflection.MethodBase.GetCurrentMethod.Name;
...
}
...
}
myName 的值为“MyMethod”。
有没有一种方法可以让我使用反射来获取 myName 的“MyClass.MyMethod”值?
【问题讨论】:
-
更正:应该是 System.Reflection.MethodBase.GetCurrentMethod().Name
标签: c# .net reflection