<分区>
Possible Duplicate:
Can you use reflection to find the name of the currently executing method?
C# how to get the name of the current method from code
例如:
void foo() {
Console.Write(__MYNAME__);
}
打印:foo
可以用 C# 实现吗?
<分区>
Possible Duplicate:
Can you use reflection to find the name of the currently executing method?
C# how to get the name of the current method from code
例如:
void foo() {
Console.Write(__MYNAME__);
}
打印:foo
可以用 C# 实现吗?
最佳答案
试试这个:
System.Reflection.MethodBase.GetCurrentMethod().Name
关于c# - 如何获取当前函数的名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10130504/