System.Collections.Generic 命名空间

包含定义泛型集合的接口和类,这些类允许用户创建强类型集合,这些集合提供比非泛型强类型集合更好的类型安全性和性能。

CollectionExtensions

为泛型集合提供扩展方法。

Comparer<T>

IComparer<T> 泛型接口的实现提供基类。

Dictionary<TKey,TValue>.KeyCollection

表示 Dictionary<TKey,TValue>中的键集合。 无法继承此类。

Dictionary<TKey,TValue>.ValueCollection

表示 Dictionary<TKey,TValue>中的值的集合。 无法继承此类。

Dictionary<TKey,TValue>

表示键和值的集合。

EqualityComparer<T>

IEqualityComparer<T> 泛型接口的实现提供基类。

HashSet<T>

表示一组值。

KeyedByTypeCollection<TItem>

提供一个集合,其项是用作键的类型。

KeyNotFoundException

当为访问集合中的元素指定的键与集合中的任何键不匹配时引发的异常。

KeyValuePair

创建 KeyValuePair<TKey,TValue> 结构的实例。

LinkedList<T>

表示一个双重链接的列表。

LinkedListNode<T>

表示 LinkedList<T>中的节点。 无法继承此类。

List<T>

表示可由索引访问的强类型对象列表。 提供用于搜索、排序和操作列表的方法。

OrderedDictionary<TKey,TValue>.KeyCollection

包含定义泛型集合的接口和类,这些类允许用户创建强类型集合,这些集合提供比非泛型强类型集合更好的类型安全性和性能。

OrderedDictionary<TKey,TValue>.ValueCollection

包含定义泛型集合的接口和类,这些类允许用户创建强类型集合,这些集合提供比非泛型强类型集合更好的类型安全性和性能。

OrderedDictionary<TKey,TValue>

包含定义泛型集合的接口和类,这些类允许用户创建强类型集合,这些集合提供比非泛型强类型集合更好的类型安全性和性能。

PriorityQueue<TElement,TPriority>.UnorderedItemsCollection

枚举 PriorityQueue<TElement,TPriority>的内容,没有任何排序保证。

PriorityQueue<TElement,TPriority>

表示具有值和优先级的项的集合。 取消排队时,将删除优先级最低的项。

Queue<T>

表示对象的先入先出集合。

ReferenceEqualityComparer

比较两个对象实例时,使用引用相等性(ReferenceEquals(Object, Object))而不是值相等性(Equals(Object))的 IEqualityComparer<T>

SortedDictionary<TKey,TValue>.KeyCollection

表示 SortedDictionary<TKey,TValue>中的键集合。 无法继承此类。

SortedDictionary<TKey,TValue>.ValueCollection

表示 SortedDictionary<TKey,TValue>中的值的集合。 无法继承此类。

SortedDictionary<TKey,TValue>

表示键/值对的集合,这些键/值对在键上排序。

SortedList<TKey,TValue>

表示根据关联的 IComparer<T> 实现按键排序的键/值对的集合。

SortedSet<T>

表示按排序顺序维护的对象集合。

Stack<T>

表示同一指定类型的实例的上一出 (LIFO) 集合的可变大小。

SynchronizedCollection<T>

提供线程安全的集合,该集合包含泛型参数指定为元素的类型的对象。

SynchronizedKeyedCollection<K,T>

提供一个线程安全的集合,该集合包含泛型参数指定的类型的对象以及按键分组的对象。

SynchronizedReadOnlyCollection<T>

提供线程安全的只读集合,该集合包含泛型参数指定为元素的类型的对象。

结构

Dictionary<TKey,TValue>.AlternateLookup<TAlternateKey>

提供一种类型,该类型可用于使用 TAlternateKey 作为键而不是 TKeyDictionary<TKey,TValue> 执行操作。

Dictionary<TKey,TValue>.Enumerator

枚举 Dictionary<TKey,TValue>的元素。

Dictionary<TKey,TValue>.KeyCollection.Enumerator

枚举 Dictionary<TKey,TValue>.KeyCollection的元素。

Dictionary<TKey,TValue>.ValueCollection.Enumerator

枚举 Dictionary<TKey,TValue>.ValueCollection的元素。

HashSet<T>.AlternateLookup<TAlternate>

提供一种类型,可用于使用 TAlternate 而不是 THashSet<T> 执行操作。

HashSet<T>.Enumerator

枚举 HashSet<T> 对象的元素。

KeyValuePair<TKey,TValue>

定义可以设置或检索的键/值对。

LinkedList<T>.Enumerator

枚举 LinkedList<T>的元素。

List<T>.Enumerator

枚举 List<T>的元素。

OrderedDictionary<TKey,TValue>.Enumerator

包含定义泛型集合的接口和类,这些类允许用户创建强类型集合,这些集合提供比非泛型强类型集合更好的类型安全性和性能。

OrderedDictionary<TKey,TValue>.KeyCollection.Enumerator

包含定义泛型集合的接口和类,这些类允许用户创建强类型集合,这些集合提供比非泛型强类型集合更好的类型安全性和性能。

OrderedDictionary<TKey,TValue>.ValueCollection.Enumerator

包含定义泛型集合的接口和类,这些类允许用户创建强类型集合,这些集合提供比非泛型强类型集合更好的类型安全性和性能。

PriorityQueue<TElement,TPriority>.UnorderedItemsCollection.Enumerator

枚举 PriorityQueue<TElement,TPriority>的元素和优先级对,没有任何排序保证。

Queue<T>.Enumerator

枚举 Queue<T>的元素。

SortedDictionary<TKey,TValue>.Enumerator

枚举 SortedDictionary<TKey,TValue>的元素。

SortedDictionary<TKey,TValue>.KeyCollection.Enumerator

枚举 SortedDictionary<TKey,TValue>.KeyCollection的元素。

SortedDictionary<TKey,TValue>.ValueCollection.Enumerator

枚举 SortedDictionary<TKey,TValue>.ValueCollection的元素。

SortedSet<T>.Enumerator

枚举 SortedSet<T> 对象的元素。

Stack<T>.Enumerator

枚举 Stack<T>的元素。

接口

IAlternateEqualityComparer<TAlternate,T>

IEqualityComparer<T> 实现以支持将 TAlternate 实例与 T 实例进行比较。

IAsyncEnumerable<T>

公开一个枚举器,该枚举器提供对指定类型的值的异步迭代。

IAsyncEnumerator<T>

支持对泛型集合进行简单的异步迭代。

ICollection<T>

定义用于操作泛型集合的方法。

IComparer<T>

定义类型实现以比较两个对象的方法。

IDictionary<TKey,TValue>

表示键/值对的泛型集合。

IEnumerable<T>

公开枚举器,该枚举器支持对指定类型的集合进行简单迭代。

IEnumerator<T>

支持对泛型集合进行简单迭代。

IEqualityComparer<T>

定义用于支持对象相等比较的方法。

IList<T>

表示可由索引单独访问的对象集合。

IReadOnlyCollection<T>

表示元素的强类型只读集合。

IReadOnlyDictionary<TKey,TValue>

表示键/值对的泛型只读集合。

IReadOnlyList<T>

表示可通过索引访问的元素的只读集合。

IReadOnlySet<T>

提供集的只读抽象。

ISet<T>

为集的抽象提供基接口。

注解

许多泛型集合类型都是非泛型类型的直接模拟。 Dictionary<TKey,TValue>Hashtable的通用版本;它使用泛型结构 KeyValuePair<TKey,TValue> 进行枚举,而不是 DictionaryEntryList<T>ArrayList的通用版本。 有与非泛型版本对应的泛型 Queue<T>Stack<T> 类。 SortedList<TKey,TValue>有泛型和非泛型版本。 这两个版本都是字典和列表的混合版本。 SortedDictionary<TKey,TValue> 泛型类是纯字典,没有非泛型类。 LinkedList<T> 泛型类是一个真正的链接列表,没有非泛型对应项。

另请参阅

  • .NET 中的泛型集合