. 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 ...