Collections are standard data structures that supplement arrays, the only built-in data structures in C#. This differs from languages such as Perl and Python, which incorporate key-value data structures and dynamically sized arrays into the language itself.
The BCL includes a set of types that provide commonly required data structures and support for creating your own. These types are typically broken down into two categories: interfaces that define a standardized set of design patterns for collection classes in general, and concrete classes that implement these interfaces and provide a usable range of data structures.
This section introduces all the concrete collection classes and
abstract collection interfaces and provides examples of their use.
Unless otherwise stated, the types mentioned in this section all
exist in the
Concrete Collection Classes
The BCL includes the concrete implementations of the collection design patterns that are described in this section.
Unlike C++, C# doesn’t yet support templates, so these
implementations work generically by accepting elements of type
is a dynamically sized array of objects
that implements the
t interface (see Section 220.127.116.11). An
ArrayList works by maintaining an internal array of objects that is replaced with a larger array when it reaches its capacity of elements. It is very efficient at adding elements (since there is usually a free slot at the ...