Chapter 10. Collections and Generics

The most primitive container within the .NET platform is the System.Array type. As you have seen over the course of the previous chapters, C# arrays allow you to define a set of identically typed items (including an array of System.Objects, which essentially represents an array of any types) of a fixed upper limit. While this will often fit the bill, there are many other times where you require more flexible data structures, such as a dynamically growing and shrinking container, or a container that can hold only items that meet a specific criteria (e.g., only items deriving from a given base class, items implementing a particular interface, or whatnot). To begin understanding the task of building flexible and ...

Get Pro C# 2008 and the .NET 3.5 Platform, Fourth Edition 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.