Table of Contents

Method By

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

By<TSortKey>(Func<TIdentity, TState, TSortKey>)

Orders by a value projected from each item.

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

Parameters

selector Func<TIdentity, TState, TSortKey>

Projects the sort value from an item.

Returns

KeyOrder<TKey, TIdentity, TState>

The order.

Type Parameters

TSortKey

The type of the projected sort value.

By<TSortKey>(Func<TIdentity, TState, TSortKey>, IComparer<TSortKey>, IComparer<TKey>, bool)

Orders by a value from each item. TSortKey stays a generic parameter to the comparer, thus this code keeps and compares each sort value as its own type and never boxes it.

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

Parameters

selector Func<TIdentity, TState, TSortKey>

Projects the sort value from an item.

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.