Figure 16.5 shows an overview of all nongeneric collection types. Also notice the implementation of interfaces like ICollection and IEnumerable.


FIGURE 16.5 Nongeneric collection types (members filtered).

Note that that the combination of IEnumerable and ICollection is enough to enable the use of the C# 3.0 collection initializer language feature:

var lst = new ArrayList { 1, 2, 3 };

The preceding code is equivalent to the following:

ArrayList __t = new ArrayList();__t.Add(1);__t.Add(2);__t.Add(3);ArrayList lst = __t;

This illustrates how new language features can make old and existing application programming ...

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.