I\'m trying to pass A list of DerivedClass to a function that takes a list of BaseClass, but I get the error:
cannot convert from
The behavior you're describing is called covariance – if A is B, then List is List.
However, for mutable types like List, that is fundamentally unsafe.
Had this been possible, the method would be able to add a new OtherDerivedClass() to a list that can actually only hold DerivedClass.
Covariance is safe on immutable types, although .Net only supports it in interfaces and delegates.
If you change the List parameter to IEnumerable, that will work