Method ByKey
- Namespace
- SodaFlow.Collections
- Assembly
- SodaFlow.Core.Collections.dll
ByKey()
Orders by key, over any stage.
public static KeyOrder<TKey, TIdentity, TState> ByKey()
Returns
- KeyOrder<TKey, TIdentity, TState>
The order.
ByKey(IComparer<TKey>, bool)
Orders by key, over any stage, with an explicit comparer.
public static KeyOrder<TKey, TIdentity, TState> ByKey(IComparer<TKey> keyComparer, bool isDescending)
Parameters
keyComparerIComparer<TKey>The comparer to order keys by.
isDescendingboolTrue when the sort uses the opposite direction.
Returns
- KeyOrder<TKey, TIdentity, TState>
The order.
Remarks
The selector is a lambda and not a method group, thus each order from this code shares one delegate instance. That lets this code identify two orders with the same comparer as the same order, and two orders with the same comparer in opposite directions as the reverse of each other. The compiler caches a lambda that captures nothing. It caches a method group only from C# 11, and this assembly also compiles at C# 10.