語言

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) 運算。

適用於