C#获取本方法名和父方法名
作者:互联网
主要代码:
System.Diagnostics.StackTrace ss = new System.Diagnostics.StackTrace(true);
System.Reflection.MethodBase mb = ss.GetFrame(1).GetMethod();
System.Reflection.MethodBase mb1 = ss.GetFrame(0).GetMethod();
string m = mb.Name;
string m1 = mb1.Name;
WriteLog($"本方法:{m1}");
WriteLog($"父方法:{m}");
标签:StackTrace,Name,C#,System,ss,名和父,m1,方法,string 来源: https://www.cnblogs.com/wml-it/p/15784956.html