【发布时间】:2011-03-24 15:16:35
【问题描述】:
给定:
public interface IA
{
void TestMethod();
}
public interface IB : IA
{
}
为什么:
typeof(IB).GetMethods().Count() == 0;
?
要明确一点:
public class A
{
public void TestMethod()
{
}
}
public class B : A
{
}
typeof(B).GetMethods().Count();
确实有效(返回 5);
作为奖励:
typeof(IB).BaseType == null
【问题讨论】:
标签: c# reflection inheritance interface