This documentation is archived and is not being maintained.

SortedDictionary.KeyCollection.SortedDictionary.KeyCollection Constructor

Initializes a new instance of the SortedDictionary.KeyCollection class that reflects the keys in the specified SortedDictionary.

Namespace: System.Collections.Generic
Assembly: System (in system.dll)

public KeyCollection (
	SortedDictionary<TKey,TValue> dictionary
public KeyCollection (
	SortedDictionary<TKey,TValue> dictionary
public function KeyCollection (
	dictionary : SortedDictionary<TKey,TValue>
Not applicable.



The SortedDictionary whose keys are reflected in the new SortedDictionary.KeyCollection.

Exception typeCondition


dictionary is a null reference (Nothing in Visual Basic).

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

This constructor is an O(1) operation.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0