C# Tutorial - Generic Collection Namespace

Generic Collection Namespace

The System.Collections.Generic namespace contains interfaces and classes that define generic collections, which allow users to create strongly typed collections that provide better type safety and performance than non-generic strongly typed collections.


Comparer<T> Provides a base class for implementations of the IComparer generic interface.
Dictionary<TKey,TValue> Represents a collection of keys and values.
HashSet<T> Represents a set of values.
LinkedList<T> Represents a doubly linked list.
List<T> Represents a strongly typed list of objects that can be accessed by index. Provides methods to search, sort, and manipulate lists.
Queue<T> Represents a first-in, first-out collection of objects.
SortedList<TKey,TValue> Represents a collection of key/value pairs that are sorted by key based on the associated IComparer implementation.
Stack<T> Represents a variable size last-in-first-out (LIFO) collection of instances of the same specified type.


Dictionary<TKey,TValue>.Enumerator Enumerates the elements of a Dictionary<TKey,TValue>.
HashSet<T>.Enumerator Enumerates the elements of a HashSet<T> object.
LinkedList<T>.Enumerator Enumerates the elements of a LinkedList<T>.
List<T>.Enumerator Enumerates the elements of a List<T>.
Queue<T>.Enumerator Enumerates the elements of a Queue<T>.


ICollection<T> Defines methods to manipulate generic collections.
Comparer Defines a method that a type implements to compare two objects.
IDictionary<TKey,TValue> Represents a generic collection of key/value pairs.
IEnumerable<T> Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
IEnumerator<T> Supports a simple iteration over a generic collection.
IList<T> Represents a collection of objects that can be individually accessed by index.
IReadOnlyCollection Represents a strongly-typed, read-only collection of elements.
ISet<T> Provides the base interface for the abstraction of sets.