KGy SOFT

CircularSortedListTKey, TValueKeys 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<TKey> Keys { get; }

Property Value

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

Reference