Values Property

SortedDictionary(Of TKey, TValue).Values Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets a collection containing the values in the SortedDictionary(Of TKey, TValue).

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

'Declaration
Public ReadOnly Property Values As SortedDictionary<(Of <(<'TKey, TValue>)>)>..::..ValueCollection

The values in the SortedDictionary(Of TKey, TValue).ValueCollection are sorted according to the Comparer property, and are in the same order as the associated keys in the SortedDictionary(Of TKey, TValue).KeyCollection returned by the Keys property.

The returned SortedDictionary(Of TKey, TValue).ValueCollection is not a static copy; instead, the SortedDictionary(Of TKey, TValue).ValueCollection refers back to the values in the original SortedDictionary(Of TKey, TValue). Therefore, changes to the SortedDictionary(Of TKey, TValue) continue to be reflected in the SortedDictionary(Of TKey, TValue).ValueCollection.

Getting the value of this property is an O(1) operation.

This code example shows how to enumerate the values in the dictionary using the Values property, and how to enumerate the keys and values in the dictionary.

This code example is part of a larger example provided for the SortedDictionary(Of TKey, TValue) class.

Windows Phone OS

Supported in: 8.1, 8.0

Show:
© 2017 Microsoft