Sasan
Sasan

Reputation: 614

How to get path of method in c# completely?

We need to transfer some method path to another project. Is there any way to get quickly method path?
For example I have a GetForContractInfoList() that is placed in App.Api.NetFinanceInfoService namespace. I want to get this path as a string by Right_Click on it:

App.Api.NetFinanceInfoService.GetForContractInfoList()

How can I get this completely?

Upvotes: 1

Views: 2063

Answers (1)

Midhun Mundayadan
Midhun Mundayadan

Reputation: 3192

enter image description hereYou can get it by Reflection.

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

Upvotes: 4

Related Questions