Possible Duplicate:
C# variance problem: Assigning List<Derived> as List<Base>
I have a problem with list inheritance. It looks like a generic List with more specified members can't converted to a list with its base members. Look at this:
class A
{
public int aValue {get; set;}
}
class B : A
{
public int anotherValue {get; set;}
}
You might now expect that a List<B> is also a List<A> but that's not the case.
List<A> myList = new List<B>() is not possible. Not even List<A> myList = (List<A>)new List<B>() Am I missing some basic concept here after 3 years in object oriented programming?