获取方法所属类的类名,方法名,在C#代码里面可以通过获取StackTrace来实现:
//获取当前类名using System.Diagnostics; using System.Reflection;
MethodBase method = new System.Diagnostics.StackTrace().GetFrame(1).GetMethod(); String className = method.ReflectedType.FullName;//获取调用者类名 MethodBase method = new System.Diagnostics.StackTrace().GetFrame(1).GetMethod(); String className = method.ReflectedType.FullName;