using System.Diagnostics;...var st = new StackTrace();var sf = st.Getframe(0);var currentMethodName = sf.GetMethod();
或者,如果您想使用辅助方法:
[MethodImpl(MethodImplOptions.NoInlining)]public string GetCurrentMethod(){ var st = new StackTrace(); var sf = st.Getframe(1); return sf.GetMethod().Name;}更新至@stusmith。



