SortedDictionary<TKey, TValue>::Keys Property
Gets a collection containing the keys in the SortedDictionary<TKey, TValue>.
Assembly: System (in System.dll)
public: property SortedDictionary<TKey, TValue>::KeyCollection^ Keys { SortedDictionary<TKey, TValue>::KeyCollection^ get(); }
Property Value
Type: System.Collections.Generic::SortedDictionary<TKey, TValue>::KeyCollection^A SortedDictionary<TKey, TValue>::KeyCollection containing the keys in the SortedDictionary<TKey, TValue>.
The keys in the SortedDictionary<TKey, TValue>::KeyCollection are sorted according to the Comparer property and are in the same order as the associated values in the SortedDictionary<TKey, TValue>::ValueCollection returned by the Values property.
The returned 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.
Getting the value of this property is an O(1) operation.
The following code example shows how to enumerate the keys in the dictionary using the Keys property, and how to enumerate the keys and values in the dictionary.
This code is part of a larger example that can be compiled and executed. See SortedDictionary<TKey, TValue>.
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1