获取当前被调用的方法

            //1.
            var methodInfo = MethodBase.GetCurrentMethod();
            Console.WriteLine(methodInfo.Name);

            //2.
            var method = new StackTrace().GetFrame(0).GetMethod();
            Console.WriteLine(method.Name);

https://blog.csdn.net/langqunlideyang/article/details/50276527

posted @ 2020-07-20 17:54  百小僧  阅读(236)  评论(0编辑  收藏  举报