I have
class A
{}
class B : A
{}
I also have a method that expects a List parameter
void AMethod(List<A> parameter)
{}
Why can’t I
List<B> bs = new List<B>();
AMethod(bs);
And secondly what is the most elegant way to make this work?
regards
You could make the method signature generic like this:
Or, you could wait for .NET 4 where this scenario is supported for IEnumerable<>