gpt4 book ai didi

c# - 如何完全获取c#中方法的路径?

转载 作者:太空宇宙 更新时间:2023-11-03 23:03:09 25 4
gpt4 key购买 nike

我们需要将一些方法路径转移到另一个项目。有什么方法可以快速获取方法路径吗?
例如,我有一个位于 App.Api.NetFinanceInfoService 命名空间中的 GetForContractInfoList()。我想通过 Right_Click 将此路径作为字符串获取:

App.Api.NetFinanceInfoService.GetForContractInfoList()

我怎样才能完全得到这个?

最佳答案

enter image description here你可以通过反射得到它。

var methodInfo = System.Reflection.MethodBase.GetCurrentMethod();
string fullName = methodInfo.DeclaringType.FullName + "." + methodInfo.Name;

关于c# - 如何完全获取c#中方法的路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42337545/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com