Redigera

Dela via


SortedDictionary<TKey,TValue>.KeyCollection Constructor

Definition

Initializes a new instance of the SortedDictionary<TKey,TValue>.KeyCollection class that reflects the keys in the specified SortedDictionary<TKey,TValue>.

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

Parameters

Exceptions

dictionary is null.

Remarks

The SortedDictionary<TKey,TValue>.KeyCollection is not a static copy; instead, the SortedDictionary<TKey,TValue>.KeyCollection refers back to the keys in the original SortedDictionary<TKey,TValue>. Therefore, changes to the SortedDictionary<TKey,TValue> continue to be reflected in the SortedDictionary<TKey,TValue>.KeyCollection.

This constructor is an O(1) operation.

Applies to