Upraviť

Zdieľať cez


Dictionary<TKey,TValue>.ValueCollection Constructor

Definition

Initializes a new instance of the Dictionary<TKey,TValue>.ValueCollection class that reflects the values in the specified Dictionary<TKey,TValue>.

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

Parameters

dictionary
Dictionary<TKey,TValue>

The Dictionary<TKey,TValue> whose values are reflected in the new Dictionary<TKey,TValue>.ValueCollection.

Exceptions

dictionary is null.

Remarks

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

This constructor is an O(1) operation.

Applies to