05 2011 档案
摘要: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方法
阅读全文