This topic has not yet been rated - Rate this topic

SortedDictionary<TKey, TValue>.IDictionary.Values Property

April 12, 2014

Gets an ICollection containing the values in the IDictionary.

Namespace:  System.Collections.Generic
Assembly:  System (in System.dll)
ICollection IDictionary.Values { get; }

Property Value

Type: System.Collections.ICollection
An ICollection containing the values in the IDictionary.



The values in the returned ICollection are sorted according to the Comparer property, and are guaranteed to be in the same order as the corresponding keys in the ICollection returned by the Keys property.

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

The following code example shows how to use the IDictionary.Values property of the System.Collections.IDictionary interface with a SortedDictionary<TKey, TValue>, to list the values in the dictionary. The example also shows how to enumerate the key/value pairs in the dictionary; note that the enumerator for the System.Collections.IDictionary interface returns DictionaryEntry objects rather than KeyValuePair<TKey, TValue> objects.

The code example is part of a larger example, including output, provided for the IDictionary.Add method.

Windows Phone OS

Supported in: 8.1, 8.0

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.