CircularSortedListTKey, TValueValues Property

Gets an indexable list containing the values in the CircularSortedListTKey, TValue, in the order of the sorted keys.

Definition

Namespace: KGySoft.Collections
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0
C#
public IList<TValue> Values { get; }

Property Value

IListTValue

Remarks

The order of the values in the IListT is the same as the order in the CircularSortedListTKey, TValue.

The returned IListT is not a static copy; instead, the IListT refers back to the values in the original CircularSortedListTKey, TValue. Therefore, changes to the CircularSortedListTKey, TValue continue to be reflected in the returned IListT.

The collection returned by the Values property provides an efficient way to retrieve keys 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 CircularListT of values. The following code shows the use of the Values property for indexed retrieval of values from a sorted list of elements with string values:

C#
string v = mySortedList.Values[3];

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

  Note

The enumerator of the returned collection supports the IEnumerator.Reset method.

See Also