Nongeneric Collection Types

Before delving into the generic collection types, it’s useful to get an idea of the legacy collection types out there in the System.Collections namespace. As you learned in the “Life Without Generics” section in Chapter 15, the only way you could create maximally applicable types in the past was to use System.Object, the mother type of all types, somewhere. The nongeneric collection types do so for their storage and hence bubble up System.Object to the type’s surface on methods like Add, Remove, and so on. The main reason to learn about those types is for survival purposes (when, for example, facing code that was written before the introduction of generics). For fresh code, generic collection types are the right choice. ...

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.