两个反射类的问题。
问题1:何时MemberInfo.Declaring和MemberInfo.ReflectionType不相等?
问题2:
public interface AInterface
{
void AMethod();
}
public class AClass:AInterface
{
void AInterface.AMethod()
{
//...
}
}
public class MainApp
{
static public void Main()
{
MethodInfo mi=typeof(AClass).GetMethod("AMethod");
//为何mi为null?
mi=typeof(AClass).GetMethod("AInterface.AMethod");
//为何mi还是为null?
}
}
后来用GetMethodes()方法列出AClass的所有方法,发现没有AMethod的踪迹,这又是为何?