考虑到
public class Generic<T> {}
public class SubGeneric<T> : Generic<T> {}
以下所有内容都是错误的:
typeof(Generic<>).IsAssignableFrom(typeof(SubGeneric<>));
typeof(SubGeneric<>).IsSubclassOf(typeof(Generic<>));
typeof(SubGeneric<>).BaseType.Equals(typeof(Generic<>));
第一个有意义(直到具体它们不能被分配)。但为什么其他两个行为是这样的呢?
Wierd<T1, T2>
不是Generic<>
的子类;它是Generic<T1>
的子类。 - SLaks