摘要: 1、返回当前方法所在的类名:using System.Reflection;string className = MethodBase.GetCurrentMethod().ReflectedType.Name;2、返回调用当前方法的方法名:using System.Diagnostics;using System.Reflection;StackTrace trace = new StackTrace(); MethodBase methodName = trace.GetFrame(1).GetMethod();3、例子 在Program类Main方法中调用TestCodon.Test方法 阅读全文
posted @ 2011-05-21 19:49 有容乃大 阅读(627) 评论(0) 推荐(0) 编辑