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; } } }