怎么知道Type是否继承了其他类型?
Type t;
// i get the t from somewhere
bool b = t.IsInhertitedFrom(typeof(BaseType));
Run Code Online (Sandbox Code Playgroud)
Jar*_*das 12
bool b = t.IsSubclassOf(typeof(BaseType))
并检查类型是否实现接口使用:
bool b = t.GetInterface(typeof(IMyInterface).FullName)!= null