Dictionary<TKey,TValue>.KeyCollection Konstruktor

Definition

Initierar en ny instans av Dictionary<TKey,TValue>.KeyCollection klassen som återspeglar nycklarna i den angivna 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))

Parametrar

Undantag

dictionary är null.

Kommentarer

Dictionary<TKey,TValue>.KeyCollection är inte en statisk kopia. I stället Dictionary<TKey,TValue>.KeyCollection refererar den tillbaka till nycklarna i den ursprungliga Dictionary<TKey,TValue>. Därför fortsätter ändringarna att Dictionary<TKey,TValue> återspeglas i Dictionary<TKey,TValue>.KeyCollection.

Den här konstruktorn är en O(1)-åtgärd.

Gäller för