Class KeyOrder<TKey, TIdentity, TState>
- Namespace
- SodaFlow.Collections
- Assembly
- SodaFlow.Core.Collections.dll
One order of the keys of a view, as a value. SortBy sorts on it.
[PublicAPI]
public abstract class KeyOrder<TKey, TIdentity, TState> where TKey : notnull where TIdentity : notnull
Type Parameters
TKeyThe type of the keys.
TIdentityThe type of the immutable part of an item.
TStateThe type of the mutable part of an item.
- Inheritance
-
KeyOrder<TKey, TIdentity, TState>
- Inherited Members
- Extension Methods
Remarks
An order holds its own sort value type, thus this type does not name that type. That is the purpose. Two orders with sort values of different types have the same type here, thus one cell can hold each one and a sort stage can follow it. A column header that a user can click needs that. Without it, a header needs one view for each column and code to select between them, which builds a graph again at each click and does not sort a key set again.
Code out of this assembly cannot make one. Build them with the
factories here, which are the equivalent of the sort methods.
SortBy sorts on By, SortByKey sorts on
ByKey, and the other pairs agree in the same manner. An order is
not attached to the collection of its construction, and only to its
type parameters. Thus, each view of the same shape can use one order.
An order can have more than one level. ThenBy and the functions
with it return this order with one more level, and that level selects
only between keys that this order ranks equal. Examples are the name of
a holder with a balance, and the second column header that a user
clicks. The result is one order, as each other order is, thus it goes
in the same cell.
Methods
- ByArrival()
Orders by arrival - the collection's own order, available over any stage.
- ByDescending<TSortKey>(Func<TIdentity, TState, TSortKey>)
Orders, descending, by a value projected from each item.
- ByIdentityDescending<TSortKey>(Func<TIdentity, TSortKey>)
Orders, descending, by a value from the immutable part of each item only.
- ByIdentity<TSortKey>(Func<TIdentity, TSortKey>)
Orders by a value from the immutable part of each item only. A state edit cannot change that part.
- 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.
- ByKey()
Orders by key, over any stage.
- ByKey(IComparer<TKey>, bool)
Orders by key, over any stage, with an explicit comparer.
- ByKeyDescending()
Orders by key, descending, over any stage.
- By<TSortKey>(Func<TIdentity, TState, TSortKey>)
Orders by a value projected from each item.
- By<TSortKey>(Func<TIdentity, TState, TSortKey>, IComparer<TSortKey>, IComparer<TKey>, bool)
Orders by a value from each item.
TSortKeystays a generic parameter to the comparer, thus this code keeps and compares each sort value as its own type and never boxes it.
- ThenByDescending<TSortKey>(Func<TIdentity, TState, TSortKey>)
This order, with its ties broken, descending, by a value projected from each item.
- ThenByIdentityDescending<TSortKey>(Func<TIdentity, TSortKey>)
This order, with a second level for keys with equal sort values, descending, by a value from the immutable part of each item only.
- ThenByIdentity<TSortKey>(Func<TIdentity, TSortKey>)
This order, with a second level for keys with equal sort values, by a value from the immutable part of each item only.
- ThenByIdentity<TSortKey>(Func<TIdentity, TSortKey>, IComparer<TSortKey>, bool)
This order, with a second level for keys with equal sort values, by a value from the immutable part of each item only.
- ThenBy<TSortKey>(Func<TIdentity, TState, TSortKey>)
This order, with its ties broken by a value projected from each item.
- ThenBy<TSortKey>(Func<TIdentity, TState, TSortKey>, IComparer<TSortKey>, bool)
This order, with its ties broken by a value projected from each item.