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
selectorFunc<TIdentity, TSortKey>Projects the sort value from an identity.
Returns
- KeyOrder<TKey, TIdentity, TState>
The order.
Type Parameters
TSortKeyThe 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
selectorFunc<TIdentity, TSortKey>Projects the sort value from an identity.
sortComparerIComparer<TSortKey>Compares two projected sort values.
keyComparerIComparer<TKey>Compares two keys with equal sort values, thus the order is total.
isDescendingboolTrue when the sort uses the opposite direction.
Returns
- KeyOrder<TKey, TIdentity, TState>
The order.
Type Parameters
TSortKeyThe type of the projected sort value.