Cannot convert from List to List

It is because List<T> is invariant, not covariant, so you should change to IEnumerable<T> which supports covariant:

IEnumerable<BaseClass> bcl = new List<DerivedClass>();

public void doSomething(IEnumerable<BaseClass> bc)
{
    // do something with bc
}

Information about covariant in generic.

Leave a Comment