IQuaternaryList.AddIndex(string, Func) method¶
Defined in
Type: IQuaternaryListReactiveList.Reactive.Collections
Assembly: ReactiveList.Reactive.dll
Applies to
net11.0, net10.0, net47, net471, net472, net48, net481
void AddIndex<TIndexKey>(string indexName, Func<T?, TIndexKey> keySelector) where TIndexKey : notnull
Summary: Adds an index to the collection using the specified name and key selector.
Type parameters
| Name | Description |
|---|---|
TIndexKey | The type of the key used for the index. Must be non-nullable. |
Parameters
| Name | Type | Description |
|---|---|---|
indexName | string (opens in a new tab) | The unique name of the index to add. Cannot be null or empty. |
keySelector | Func | A function that extracts the key from each element in the collection. Cannot be null. |
Remarks
If an index with the specified name already exists, this method may throw an exception or overwrite the existing index, depending on the implementation. Indexes can improve lookup performance for queries using the specified key.