The problem here is although ChildObject
can be a child of ParentObject
, List<ChildObject>
is not a child of List<ParentObject>
. List<ChildObject>
is a object of type List
and so is the List<ParentObject>
You can change your ParentCollection
like this to achieve what you want.
abstract class ParentCollection
{
public IEnumerable<ParentObject> MyList { get; set; }
public ParentCollection() { }
}
You might also want to look into Covarience and Contravarience.