Summary

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

Image

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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.