How to find FULL name of calling method C#

前端 未结 5 1926
别那么骄傲
别那么骄傲 2020-12-31 00:24

How can I find the full name of a calling method in c#. I have seen solutions:

How I can get the calling methods in C#

How can I find the method that called

5条回答
  •  借酒劲吻你
    2020-12-31 01:16

    This is something like here.

    MethodBase method = stackTrace.GetFrame(1).GetMethod();
    string methodName = method.Name;
    string className = method.ReflectedType.Name;
    
    Console.WriteLine(className + "." + methodName);
    

提交回复
热议问题