Class ComparerChainingExtensions
- Namespace
- ReactiveUI
- Assembly
- ReactiveUI.dll
Convenience class to help chain selectors onto existing parent comparers.
- Inheritance
-
Comparer
Chaining Extensions
Methods
ThenByDescending<T, TValue>(IComparer<T>?, Func<T, TValue>)
Creates a derived comparer based on the given parent comparer. The returned comparer will sort elements using the parent comparer first. If the parent considers the values equal elements will be sorted in descending order based on the values returned by the provided selector. The selector values will be compared using the default comparer for the return type of the selector.
public static IComparer<T> ThenByDescending<T, TValue>(this IComparer<T>? parent, Func<T, TValue> selector)
Parameters
parent
IComparer<T>The parent comparer to use first.
selector
Func<T, TValue>A function supplying the values for the comparer.
Returns
- IComparer<T>
A comparer.
Type Parameters
T
The comparison type.
TValue
The value type.
ThenByDescending<T, TValue>(IComparer<T>?, Func<T, TValue>, IComparer<TValue>)
Creates a derived comparer based on the given parent comparer. The returned comparer will sort elements using the parent comparer first. If the parent considers the values equal elements will be sorted in descending order based on the values returned by the provided selector. The selector values will be compared using the provided comparer or the default comparer for the return type of the selector if no comparer is specified.
public static IComparer<T> ThenByDescending<T, TValue>(this IComparer<T>? parent, Func<T, TValue> selector, IComparer<TValue> comparer)
Parameters
parent
IComparer<T>The parent comparer to use first.
selector
Func<T, TValue>A function supplying the values for the comparer.
comparer
IComparer<TValue>The comparer to use when comparing the values returned by the selector.
Returns
- IComparer<T>
A comparer.
Type Parameters
T
The comparison type.
TValue
The value type.
ThenBy<T, TValue>(IComparer<T>?, Func<T, TValue>)
Creates a derived comparer based on the given parent comparer. The returned comparer will sort elements using the parent comparer first. If the parent considers the values equal elements will be sorted in ascending order based on the values returned by the provided selector. The selector values will be compared using the default comparer for the return type of the selector.
Parameters
parent
IComparer<T>The parent comparer to use first.
selector
Func<T, TValue>A function supplying the values for the comparer.
Returns
- IComparer<T>
A comparer.
Type Parameters
T
The comparison type.
TValue
The value type.
ThenBy<T, TValue>(IComparer<T>?, Func<T, TValue>, IComparer<TValue>)
Creates a derived comparer based on the given parent comparer. The returned comparer will sort elements using the parent comparer first. If the parent considers the values equal elements will be sorted in ascending order based on the values returned by the provided selector. The selector values will be compared using the provided comparer or the default comparer for the return type of the selector if no comparer is specified.
public static IComparer<T> ThenBy<T, TValue>(this IComparer<T>? parent, Func<T, TValue> selector, IComparer<TValue> comparer)
Parameters
parent
IComparer<T>The parent comparer to use first.
selector
Func<T, TValue>A function supplying the values for the comparer.
comparer
IComparer<TValue>The comparer to use when comparing the values returned by the selector.
Returns
- IComparer<T>
A comparer.
Type Parameters
T
The comparison type.
TValue
The value type.