我们需要将一些方法路径转移到另一个项目。有什么方法可以快速获取方法路径吗?
例如,我有一个位于 App.Api.NetFinanceInfoService
命名空间中的 GetForContractInfoList()
。我想通过 Right_Click 将此路径作为字符串获取:
App.Api.NetFinanceInfoService.GetForContractInfoList()
我怎样才能完全得到这个?
最佳答案
var methodInfo = System.Reflection.MethodBase.GetCurrentMethod();
string fullName = methodInfo.DeclaringType.FullName + "." + methodInfo.Name;
关于c# - 如何完全获取c#中方法的路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42337545/