Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Collections and Data Structures

Closely related data can be handled more efficiently when grouped together into a collection. Instead of writing separate code to handle each individual object, you can use the same code to process all the elements of a collection.

To manage a collection, use the Array class and the System.Collections classes to add, remove, and modify either individual elements of the collection or a range of elements. An entire collection can even be copied to another collection.

Some Collections classes have sorting capabilities, and most are indexed. Memory management is handled automatically, and the capacity of a collection is expanded as required. Synchronization provides thread safety when accessing members of the collection. Some Collections classes can generate wrappers that make the collection read-only or fixed-size. Any Collections class can generate its own enumerator that makes it easy to iterate through the elements.

In the .NET Framework version 2.0, generic collection classes provide new functionality and make it easy to create strongly typed collections. See the System.Collections.Generic and System.Collections.ObjectModel namespaces.

The LINQ to Objects feature allows you to use LINQ queries to access in-memory objects as long as the object type implements IEnumerable or IEnumerable<T>. LINQ queries provide a common pattern for accessing data; are typically more concise and readable than standard foreach loops; and provide filtering, ordering and grouping capabilities. LINQ queries can also improve performance. For more information, see LINQ to Objects.

Defining Collections

Describes what collection types are, and some differences between generic and nongeneric collection types in the .NET Framework class library.

Commonly Used Collection Types

Describes commonly used generic and nongeneric collection types such as Array, List<T>, and Dictionary<TKey, TValue>.

Bit Collections

Describes BitArray and BitVector32 collection types.

Specialized Collections

Describes special-purpose collections such as NameValueCollection, StringDictionary, and StringCollection.

Creating and Manipulating Collections

Discusses selecting the best collection type, enumerating collections, using collections with multiple threads, and sorting collections.

When to Use Generic Collections

Discusses the use of generic collection types.

Array

Describes the major features of the Array class, which provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the base class for all arrays in the common language runtime.

System.Collections

Provides reference documentation for the System.Collections namespace, which contains interfaces and classes that define various collections of objects.

System.Collections.Generic

Provides reference documentation for the System.Collections.Generic namespace, which contains interfaces and classes that define generic collections.

System.Collections.Specialized

Provides reference documentation for the System.Collections.Specialized namespace, which contains specialized and strongly-typed collections.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft