如何获得方法名称win 8 app

Cog*_*ire 7 c# windows-8

如何在win 8(WinRT)应用程序中获取当前方法名称...在wp7中我们可以使用System.Reflection.MethodBase.GetCurrentMethod().Name但是它不再存在

Mar*_*ell 6

是的,.NETCore缺少了很多这样的事情......,他们甚至没有得到我开始GetTypeInfo()!但也许一个实用的解决方法是让编译器为你做这个?

string CallerName([CallerMemberName]string caller = "")
{
    return caller;
}
...
string name = CallerName();
Run Code Online (Sandbox Code Playgroud)