Table of Contents

Method IndexOf

Namespace
SodaFlow.Collections
Assembly
SodaFlow.Collections.dll

IndexOf<TKey, TIdentity, TState>(OrderedKeys<TKey, TIdentity, TState>, TKey)

The position of a key in an ordered set, when the set has that key.

[Pure]
public static Maybe<int> IndexOf<TKey, TIdentity, TState>(this OrderedKeys<TKey, TIdentity, TState> keys, TKey key) where TKey : notnull where TIdentity : notnull

Parameters

keys OrderedKeys<TKey, TIdentity, TState>

The ordered set to look in.

key TKey

The key to look for.

Returns

Maybe<int>

Its position, or no value when the key is missing.

Type Parameters

TKey

The type of the keys.

TIdentity

The type of the immutable part of an item.

TState

The type of the mutable part of an item.

Remarks

The core answers -1 for a missing key, which is the convention of each other IndexOf in the framework, and it keeps that answer private. This is the only IndexOf in the public C# API, and it answers as the other parts of the C# API do.