In Java, I can do the following: (assume Subclass
extends Base
):
ArrayList<? extends Base> aList = new ArrayList<Subclass>();
What is the equivalent in C# .NET? There is no ? extends
keyword apparently and this does not work:
List<Base> aList = new List<Subclass>();
See Question&Answers more detail:os