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, “Generic Types and Methods,” 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access