System.Collections.Generic.SortedList<TKey,TValue>.Values Property

Gets a collection containing the values in the SortedList`2.

Syntax

public IList<TValue> Values { get; }

Value

Documentation for this section has not yet been entered.

Remarks

The order of the values in the IList`1 is the same as the order in the SortedList`2.

The returned IList`1 is not a static copy; instead, the IList`1 refers back to the values in the original SortedList`2. Therefore, changes to the SortedList`2 continue to be reflected in the IList`1.

The collection returned by the SortedList`2.Values property provides an efficient way to retrieve values by index. It is not necessary to regenerate the list when the property is accessed, because the list is just a wrapper for the internal array of values. The following code shows the use of the SortedList`2.Values property for indexed retrieval of values from a sorted list of strings:

code reference: Generic.SortedList#11

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

Requirements

Namespace: System.Collections.Generic
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0