我想获取列表的方法“ElementAt”的 MethodInfo。
MethodInfo method = obj.GetType().GetMethod("ElementAt");
但是,“方法”是“空”。 我尝试在每个接口(interface)上循环,但结果是一样的:
MethodInfo method = obj.GetType().GetMethod("ElementAt");
if (method == null)
{
foreach (Type type in obj.GetType().GetInterfaces())
{
method = type.GetMethod("ElementAt");
if (method != null)
break;
}
}
有人知道怎么做吗?
如有任何帮助,我们将不胜感激。谢谢!
最佳答案
关于c# - 反射 : can't get List "ElementAt" MethodInfo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17011819/