Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
This chapter discusses one of the most important parts of the .NET Framework: collections. In C#, a collection is a group of objects. The .NET Framework contains a large number of interfaces and classes that define and implement various types of collections. Collections simplify many programming tasks because they provide off-the-shelf solutions to several common, but sometimes tedious-to-develop, data structures. For example, there are built-in collections that support dynamic arrays, linked lists, stacks, queues, and hash tables. Collections are a state-of-the-art technology that merits close attention by all C# programmers.
Originally, there were only non-generic collection classes. However, the addition of generics in C# 2.0 coincided with the addition of many new generic classes and interfaces to the .NET Framework. The inclusion of the generic collections essentially doubled the number of collection classes and interfaces. With the advent of the Task Parallel Library in .NET Framework 4.0, several new thread-safe collection classes were added that are designed for use in situations in which multiple threads access a collection. As you can surmise, the Collections API is a very large part of the .NET Framework.