I expected the next test to pass, but it is not.
var iCollectionType = typeof(ICollection<>);
var listSuper = typeof(List<>).GetInterfaces().First(i => i.GUID == iCollectionType.GUID);
Assert.That(listSuper, Is.EqualTo(iCollectionType));
I know that the same type loaded in 2 different application domains is not considered equal. I donβt see how this can happen in the above code, but I checked the AssemblyQualifiedName of each type and, of course, they are different.
iCollectionType.AssemblyQualifiedName.Dump();
listSuper.AssemblyQualifiedName.Dump();
When I tested further, I found that this applies to all common interfaces in the list of interfaces for defining a common type, as well as for basic base types; but not for non-generic interfaces and base types, nor for constructed generic types.
I would like to know why the general type definitions that I get using typeof seem incompatible with those listed in their inheritance list and base type. This seems less than surprising.
Type.AssemblyQualifiedName MSDN, .
Type , null.
, , , , .
LinqPad v5.02.03, .