3
如何知道类型是否继承了其他类型?如何知道类型是否继承了其他类型?
Type t;
// i get the t from somewhere
bool b = t.IsInhertitedFrom(typeof(BaseType));
如何知道类型是否继承了其他类型?如何知道类型是否继承了其他类型?
Type t;
// i get the t from somewhere
bool b = t.IsInhertitedFrom(typeof(BaseType));
布尔B = t.IsSubclassOf(typeof运算(碱基类型))
并检查类型实现接口使用:
布尔B = t.GetInterface(typeof运算(IMyInterface的).FullName) != null