Condividi tramite


System.Collections.Generic Namespace

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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.

System.Collections

Classes

  Class Description
Public class Comparer<T> Provides a base class for implementations of the IComparer<T> generic interface.
Public class Dictionary<TKey, TValue> Represents a collection of keys and values.
Public class Dictionary<TKey, TValue>.KeyCollection Represents the collection of keys in a Dictionary<TKey, TValue>. This class cannot be inherited.
Public class Dictionary<TKey, TValue>.ValueCollection Represents the collection of values in a Dictionary<TKey, TValue>. This class cannot be inherited.
Public class EqualityComparer<T> Provides a base class for implementations of the IEqualityComparer<T> generic interface.
Public class HashSet<T> Represents a set of values.
Public class KeyedByTypeCollection<TItem> Provides a collection whose items are types that serve as keys.
Public class KeyNotFoundException The exception that is thrown when the key specified for accessing an element in a collection does not match any key in the collection.
Public class LinkedList<T> Represents a doubly linked list.
Public class LinkedListNode<T> Represents a node in a LinkedList<T>. This class cannot be inherited.
Public class List<T> Represents a strongly typed list of objects that can be accessed by index. Provides methods to search, sort, and manipulate lists.
Public class Queue<T> Represents a first-in, first-out collection of objects.
Public class Stack<T> Represents a variable size last-in-first-out (LIFO) collection of instances of the same arbitrary type.
Public class SynchronizedReadOnlyCollection<T> Provides a thread-safe, read-only collection that contains objects of a type specified by the generic parameter as elements.

Structures

  Structure Description
Public structure Dictionary<TKey, TValue>.Enumerator Enumerates the elements of a Dictionary<TKey, TValue>.
Public structure Dictionary<TKey, TValue>.KeyCollection.Enumerator Enumerates the elements of a Dictionary<TKey, TValue>.KeyCollection.
Public structure Dictionary<TKey, TValue>.ValueCollection.Enumerator Enumerates the elements of a Dictionary<TKey, TValue>.ValueCollection.
Public structure HashSet<T>.Enumerator Enumerates the elements of a HashSet<T> object.
Public structure KeyValuePair<TKey, TValue> Defines a key/value pair that can be set or retrieved.
Public structure LinkedList<T>.Enumerator Enumerates the elements of a LinkedList<T>.
Public structure List<T>.Enumerator Enumerates the elements of a List<T>.
Public structure Queue<T>.Enumerator Enumerates the elements of a Queue<T>.
Public structure Stack<T>.Enumerator Enumerates the elements of a Stack<T>.

Interfaces

  Interface Description
Public interface ICollection<T> Defines methods to manipulate generic collections.
Public interface IComparer<T> Defines a method that a type implements to compare two objects.
Public interface IDictionary<TKey, TValue> Represents a generic collection of key/value pairs.
Public interface IEnumerable<T> Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
Public interface IEnumerator<T> Supports a simple iteration over a generic collection.
Public interface IEqualityComparer<T> Defines methods to support the comparison of objects for equality.
Public interface IList<T> Represents a collection of objects that can be individually accessed by index.
Public interface ISet<T> Provides the base interface for the abstraction of sets.