语言

Dictionary<TKey,TValue>.KeyCollection 构造函数

定义

初始化反映指定Dictionary<TKey,TValue>.KeyCollection键的Dictionary<TKey,TValue>类的新实例。

public:
 KeyCollection(System::Collections::Generic::Dictionary<TKey, TValue> ^ dictionary);
public KeyCollection(System.Collections.Generic.Dictionary<TKey,TValue> dictionary);
new System.Collections.Generic.Dictionary<'Key, 'Value>.KeyCollection : System.Collections.Generic.Dictionary<'Key, 'Value> -> System.Collections.Generic.Dictionary<'Key, 'Value>.KeyCollection
Public Sub New (dictionary As Dictionary(Of TKey, TValue))

参数

例外

dictionary 是 null。

注解

这不是 Dictionary<TKey,TValue>.KeyCollection 静态副本;而是 Dictionary<TKey,TValue>.KeyCollection 引用原始 Dictionary<TKey,TValue>副本中的键。 因此,对 Dictionary<TKey,TValue> 继续所做的更改将反映在中 Dictionary<TKey,TValue>.KeyCollection。

此构造函数是 O(1) 操作。

适用于