Look at the following example (partially taken from MSDN Blog):
class Animal { }
class Giraffe : Animal { }
static void Main(string[] args)
{
// Array a
GenericClass and GenericClass and two distinct closed constructed generic types of GenericClass<> open generic type and they not inherit one from the other.
So you can't cast GenericClass to GenericClass even if B inherits from A.
It is like you ask to cast this:
class A2 : A1;
class B2 : B1;
var a2 = new A2();
var b2 = new B2();
var x = (A1)b2;
GenericClass and GenericClass are as distinct as A1 and B2.
But they are all object.
And since there is no diamond operator in C# yet, you can't use true polymorphism on open generic type underlying to closed constructed types like this:
var x = (GenericClass<>)b;
You can't create list like this:
List<> list;
You can't do polymorphism on such list... and it is a lack in genericity here.
For example, in C# you can't create a List instance to have some Washer and some Washer to operate Wash() on them... and to do that you need an ugly interface pattern...
Generics -Open and closed constructed Types
About the lack of true generic polymorphism and the missing diamond operator in C#