【发布时间】:2010-09-17 20:44:06
【问题描述】:
如果我有这样的方法:
public void MyMethod(int arg1, string arg2)
我将如何获取参数的实际名称? 我似乎在 MethodInfo 中找不到任何实际上会给我参数名称的东西。
我想写一个如下所示的方法:
public static string GetParamName(MethodInfo method, int index)
所以如果我调用这个方法:
string name = GetParamName(MyMethod, 0)
它将返回“arg1”。这可能吗?
【问题讨论】:
标签: c# .net reflection