Table of Contents

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

T

The 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

Left T

The left value in the comparison.

Right T

The 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

selector Func<T, Task<TResult>>

Returns

AsyncComparisonInfo<T>

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

selector Func<T, ValueTask<TResult>>

Returns

AsyncComparisonInfo<T>

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

selector Func<T, Task<TResult>>

Returns

AsyncComparisonInfo<T>

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

selector Func<T, ValueTask<TResult>>

Returns

AsyncComparisonInfo<T>

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

selector Func<T, Task<TResult>>

Returns

ValueTask<ComparisonInfo<T>>

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

selector Func<T, ValueTask<TResult>>

Returns

ValueTask<ComparisonInfo<T>>

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

selector Func<T, TResult>

The selector of the compared values.

Returns

ComparisonInfo<T>

A ComparisonInfo<T> with the result.

Type Parameters

TResult

The 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

selector Func<T, Task<TResult>>

Returns

ValueTask<ComparisonInfo<T>>

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

selector Func<T, ValueTask<TResult>>

Returns

ValueTask<ComparisonInfo<T>>

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

selector Func<T, TResult>

The selector of the compared values.

Returns

ComparisonInfo<T>

A ComparisonInfo<T> with the result.

Type Parameters

TResult

The 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.