Struct ComparisonSource<T>
- Namespace
- Garyon.Extensions.Comparison
- Assembly
- Garyon.dll
Defines the comparison source of two values of the same type.
public readonly record struct ComparisonSource<T> : IEquatable<ComparisonSource<T>>
Type Parameters
TThe type of values being compared.
- Implements
- Inherited Members
- Extension Methods
Constructors
ComparisonSource(T, T)
Defines the comparison source of two values of the same type.
public ComparisonSource(T Left, T Right)
Parameters
LeftTThe left value in the comparison.
RightTThe right value in the comparison.
Properties
Left
The left value in the comparison.
public T Left { get; init; }
Property Value
- T
Right
The right value in the comparison.
public T Right { get; init; }
Property Value
- T
Methods
ByAsync<TResult>(Func<T, Task<TResult>>)
Compares the two values by a projected value asynchronously, without breaking fluent chaining.
public AsyncComparisonInfo<T> ByAsync<TResult>(Func<T, Task<TResult>> selector) where TResult : IComparable<TResult>
Parameters
Returns
Type Parameters
TResult
ByAsync<TResult>(Func<T, ValueTask<TResult>>)
Compares the two values by a projected value asynchronously, without breaking fluent chaining.
public AsyncComparisonInfo<T> ByAsync<TResult>(Func<T, ValueTask<TResult>> selector) where TResult : IComparable<TResult>
Parameters
Returns
Type Parameters
TResult
ByDescAsync<TResult>(Func<T, Task<TResult>>)
Compares the two values by a projected value asynchronously in descending order, without breaking fluent chaining.
public AsyncComparisonInfo<T> ByDescAsync<TResult>(Func<T, Task<TResult>> selector) where TResult : IComparable<TResult>
Parameters
Returns
Type Parameters
TResult
ByDescAsync<TResult>(Func<T, ValueTask<TResult>>)
Compares the two values by a projected value asynchronously in descending order, without breaking fluent chaining.
public AsyncComparisonInfo<T> ByDescAsync<TResult>(Func<T, ValueTask<TResult>> selector) where TResult : IComparable<TResult>
Parameters
Returns
Type Parameters
TResult
ByDesc<TResult>(Func<T, Task<TResult>>)
Compares the two values by a projected value asynchronously in descending order.
public ValueTask<ComparisonInfo<T>> ByDesc<TResult>(Func<T, Task<TResult>> selector) where TResult : IComparable<TResult>
Parameters
Returns
Type Parameters
TResult
ByDesc<TResult>(Func<T, ValueTask<TResult>>)
Compares the two values by a projected value asynchronously in descending order.
public ValueTask<ComparisonInfo<T>> ByDesc<TResult>(Func<T, ValueTask<TResult>> selector) where TResult : IComparable<TResult>
Parameters
Returns
Type Parameters
TResult
ByDesc<TResult>(Func<T, TResult>)
Compares the two values by a projected value in descending order.
public ComparisonInfo<T> ByDesc<TResult>(Func<T, TResult> selector) where TResult : IComparable<TResult>
Parameters
selectorFunc<T, TResult>The selector of the compared values.
Returns
- ComparisonInfo<T>
A ComparisonInfo<T> with the result.
Type Parameters
TResultThe type of the projected value that will be compared.
By<TResult>(Func<T, Task<TResult>>)
Compares the two values by a projected value asynchronously.
public ValueTask<ComparisonInfo<T>> By<TResult>(Func<T, Task<TResult>> selector) where TResult : IComparable<TResult>
Parameters
Returns
Type Parameters
TResult
By<TResult>(Func<T, ValueTask<TResult>>)
Compares the two values by a projected value asynchronously.
public ValueTask<ComparisonInfo<T>> By<TResult>(Func<T, ValueTask<TResult>> selector) where TResult : IComparable<TResult>
Parameters
Returns
Type Parameters
TResult
By<TResult>(Func<T, TResult>)
Compares the two values by a projected value that implements IComparable<T>.
public ComparisonInfo<T> By<TResult>(Func<T, TResult> selector) where TResult : IComparable<TResult>
Parameters
selectorFunc<T, TResult>The selector of the compared values.
Returns
- ComparisonInfo<T>
A ComparisonInfo<T> with the result.
Type Parameters
TResultThe type of the projected value that will be compared.
Self()
Compares the two values as themselves.
public ComparisonInfo<T> Self()
Returns
- ComparisonInfo<T>
A ComparisonInfo<T> with the result.