|
Generic Class/Interface
|
Description
|
Non-Generic Equivalent
|
|
Collection<T>, ICollection<T>
|
Provides the base class for a generic collection.
|
CollectionBase, ICollection
|
|
Comparer<T>, IComparer<T>, IComparable<T>
|
Compares two objects of the same generic type for equivalence and for
sorting.
|
Comparer, IComparer, IComparable
|
|
Dictionary<K, V>, IDictionary<K,V>
|
Represents a collection of key/value pairs that are organized based on the
key.
|
Hashtable, IDictionary
|
|
Dictionary<K, V>.KeyCollection
|
Represents the collection of keys in a Dictionary<K, V>.
|
None.
|
|
Dictionary<K, V>.ValueCollection
|
Represents the collection of values in a Dictionary<K, V>.
|
None.
|
|
IEnumerable<T>, IEnumerator<T>
|
Represents a collection that can be iterated using foreach.
|
IEnumerable, IEnumerator
|
|
KeyedCollection<T, U>
|
Represents a keyed collection.
|
KeyedCollection
|
|
LinkedList<T>
|
Represents a doubly linked list.
|
None.
|
|
LinkedListNode<T>
|
Represents a node in a LinkedList<T>.
|
None.
|
|
List<T>, IList<T>
|
Implements the IList<T> interface using an array whose size is dynamically
increased as required.
|
ArrayList, IList
|
|
Queue<T>
|
Represents a first-in, first-out collection of objects.
|
Queue
|
|
ReadOnlyCollection<T>
|
Provides the base class for a generic read-only collection.
|
ReadOnlyCollectionBase
|
|
SortedDictionary<K, V>
|
Represents a collection of key/value pairs that are sorted by key based on the
associated IComparer<T> implementation.
|
SortedList
|
|
Stack<T>
|
Represents a simple last-in-first-out (LIFO) collection of objects.
|
Stack
|
|
Constraint
|
Description
|
|
where T: struct
|
The type argument must be a value type.
|
|
where T : class
|
The type argument must be a reference type.
|
|
where T : new()
|
The type argument must have a public parameterless constructor. When used in conjunction with other constraints, the new() constraint must be specified last.
|
|
where T : <base class name>
|
The type argument must be or derive from the specified base class.
|
|
where T : <interface name>
|
The type argument must be or implement the specified interface. Multiple interface constraints can be specified. The constraining interface can also be generic.
|