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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…