If I have a method such as:
public void MyMethod(int arg1, string arg2)
How would I go about getting the actual names of the arguments?
I can't seem to find anything in the MethodInfo which will actually give me the name of the parameter.
I would like to write a method which looks like this:
public static string GetParamName(MethodInfo method, int index)
So if I called this method with:
string name = GetParamName(MyMethod, 0)
it would return "arg1". Is this possible?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…