KGy SOFT

CircularSortedListTKey, TValueValues Property

KGy SOFT Core Libraries Help

Namespace:  KGySoft.Collections
Assembly:  KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 5.0.0-rc.1
Syntax

public IList<TValue> Values { get; }

Property Value

Type: 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 Note
The enumerator of the returned collection supports the IEnumerator.Reset method.
See Also

Reference