Dictionary<TKey,TValue>.KeyCollection Konstruktor
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
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
- dictionary
- Dictionary<TKey,TValue>
Vars Dictionary<TKey,TValue> nycklar återspeglas i den nya Dictionary<TKey,TValue>.KeyCollection.
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.