loading...

re: Existentially quantified types in C# - Part 2 VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Polymorphic in that each item in list can be of any type right? Not polymorphic in that each list item can have multiple types or can it?
 

A list "carton" is a lot like an IList<T>. Each carton contains only one type of item. You can create a carton of ints or a carton of strings, and you can ensure that ints and strings aren’t mixed together in a single carton.

The important difference between an IList<T> and an IListCarton is that a carton of ints and a carton of strings have exactly the same type (IListCarton), but IList<int> isn't the same type as IList<string>.

Code of Conduct Report abuse