我有一个类类型的方法的MethodInfo
,它是该类实现的接口(interface)定义的一部分。
如何检索类实现的接口(interface)类型上方法的匹配 MethodInfo
对象?
最佳答案
我想我找到了最好的方法:
var methodParameterTypes = classMethod.GetParameters().Select(p => p.ParameterType).ToArray();
MethodInfo interfaceMethodInfo = interfaceType.GetMethod(classMethod.Name, methodParameterTypes);
关于c# - 如果我有继承类类型的 MethodInfo,如何获取接口(interface)的 MethodInfo?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14621451/