As you can see here I'm trying to assign a generic class instance to another generic class instance from different type T
, but B
inherits from A
.
My logic says it must be able to be done, maybe I'm missing something.
abstract class A
{
}
class B : A
{
}
class C<T> where T : A
{
}
static void Main(string[] args)
{
C<A> class1;
C<B> class2;
class1 = class2;
}