C#获得调用方法的名称和类名

(new StackTrace()).GetFrame(1) // 0为本身的方法;1为调用方法
(new StackTrace()).GetFrame(1).GetMethod().Name; // 方法名
(new StackTrace()).GetFrame(1).GetMethod().ReflectedType.Name; // 类名

posted @ 2009-10-29 14:59  angushine  阅读(4350)  评论(0编辑  收藏  举报