. new StackTrace .GetFrame 为本身的方法 为调用方法 . new StackTrace .GetFrame .GetMethod .Name 方法名 . new StackTrace .GetFrame .GetMethod .ReflectedType.Name 类名 获取当前方法的名称空间 类名和方法名称 ...
2017-10-23 09:49 4 17085 推荐指数:
1、获取当前类名: this.getClass().getSimpleName() 也可以 2、获取当前方法名: ...
public static string GetMethodInfo() { string str = "" ; //取得当前方法命名空间 str += "命名空间名 ...
public static string GetMethodInfo() { string str = "" ; //取得当前方法命名空间 str ...
对当前运行程序,可用如下程序获取当前的命名空间、类名、方法名: https://www.cnblogs.com/cang12138/p/7714651.html ...
string typeName = this.GetType().ToString();//空间名.类名 string typeName = this.GetType().Name;//类名 new System.Diagnostics.StackTrace().GetFrame ...
需要命名空间:using System.Reflection ...