Table of Contents

Method ByIdentity

Namespace
SodaFlow.Collections
Assembly
SodaFlow.Core.Collections.dll

ByIdentity<TSortKey>(Func<TIdentity, TSortKey>)

Orders by a value from the immutable part of each item only. A state edit cannot change that part.

public static KeyOrder<TKey, TIdentity, TState> ByIdentity<TSortKey>(Func<TIdentity, TSortKey> selector)

Parameters

selector Func<TIdentity, TSortKey>

Projects the sort value from an identity.

Returns

KeyOrder<TKey, TIdentity, TState>

The order.

Type Parameters

TSortKey

The type of the projected sort value.

Remarks

This costs less to keep than By for the same values. A stage in this order does not sort a key again when it hears only that the key changed, and the construction of a stage never reads the state map. The selector does not receive the state, thus a reader can test this property and does not use a statement.

ByIdentity<TSortKey>(Func<TIdentity, TSortKey>, IComparer<TSortKey>, IComparer<TKey>, bool)

Orders by a value from the immutable part of each item only. A state edit cannot change that part.

public static KeyOrder<TKey, TIdentity, TState> ByIdentity<TSortKey>(Func<TIdentity, TSortKey> selector, IComparer<TSortKey> sortComparer, IComparer<TKey> keyComparer, bool isDescending)

Parameters

selector Func<TIdentity, TSortKey>

Projects the sort value from an identity.

sortComparer IComparer<TSortKey>

Compares two projected sort values.

keyComparer IComparer<TKey>

Compares two keys with equal sort values, thus the order is total.

isDescending bool

True when the sort uses the opposite direction.

Returns

KeyOrder<TKey, TIdentity, TState>

The order.

Type Parameters

TSortKey

The type of the projected sort value.