如果我声明自己的接口,我无法获得声明的方法
public interface ITest
{
string TestProp { get; set; }
void TestMethod();
}
MethodInfo[] declaredMethods = typeof(ITest).GetDeclaredMethods();
//declaredMethods.Length == 0
MethodInfo[] methods = typeof(ITest).GetMethods();
//methods.Length == 0
如果我尝试在其他接口(例如 IEnumerable)上获取声明的方法,它就可以正常工作。
谁能帮我理解我做错了什么。
谢谢!