
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
280
Chapter 5
CHAPTER 5
Collections
5.0 Introduction
Collections are groups of items; in .NET, collections contain objects (including boxed
value types). Each object contained in a collection is called an element. Some collec-
tions contain a straightforward list of elements, while others (dictionaries) contain a
list of key and value pairs. The following collection types consist of a straightfor-
ward list of elements:
System.Collections.ArrayList
System.Collections.BitArray
System.Collections.Queue
System.Collections.Stack
System.Collections.Generic.LinkedList<T>
System.Collections.Generic.List<T>
System.Collections.Generic.Queue<T>
System.Collections.Generic.Stack<T>
The following collection types are dictionaries:
System.Collections.Hashtable
System.Collections.SortedList
System.Collections.Generic.Dictionary<T,U>
System.Collections.Generic.SortedList<T,U>
These collection classes are organized under the System.Collections and the System.
Collections.Generic
namespaces. In addition to these namespaces, another namespace
called
System.Collections.Specialized contains a few more useful collection classes.
These classes might not be as well known as the previous classes, so here is a short
explanation of the collection classes under the
System.Collections.Specialized
namespace: