Is there any way to accomplish something like List<object> list = new List<int>() in C#?
Posted
by devoured elysium
on Stack Overflow
See other posts from Stack Overflow
or by devoured elysium
Published on 2010-04-26T22:12:30Z
Indexed on
2010/04/26
22:13 UTC
Read the original article
Hit count: 114
That is the question. What I want to accomplish is something similar to the following Java code:
class A { }
class B extends A { }
public class Tests {
public static void main(String [] args) {
ArrayList<? extends A> lists = new ArrayList<B>();
}
}
(in which B extends A
means B inherits from A)
Is it possible at all?
Thanks
© Stack Overflow or respective owner