CircularSortedListTKey, TValueKeys Property

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

Definition

Namespace: KGySoft.Collections
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 8.2.0
C#
public IList<TKey> Keys { get; }

Property Value

IListTKey

Remarks

The order of the keys 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 keys in the original CircularSortedListTKey, TValue. Therefore, changes to the CircularSortedListTKey, TValue continue to be reflected in the returned IListT.

The collection returned by the Keys 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 keys. The following code shows the use of the Keys property for indexed retrieval of keys from a sorted list of elements with string keys:

C#
string v = mySortedList.Keys[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