namespace EF6._0Test { class Program { static void Main(string[] args) { int aa= 10; aa.add(11); Console.ReadLine(); } } public static class AAA { public static int add(this int n, int m) { StackFrame frame = new StackFrame(1); //偏移一个函数位,也即是获取当前函数的前一个调用函数 MethodBase method = frame.GetMethod(); //取得调用函数 Console.WriteLine(string.Format($"{method.ReflectedType.FullName}.{method.Name}")); return n + m; } } }

转载于:https://www.cnblogs.com/lgxlsm/p/7908817.html
最后
以上就是动人萝莉最近收集整理的关于获取调用方法路径的全部内容,更多相关获取调用方法路径内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复