SuperLinq SuperLinq
SuperLinq SuperLinq
DocFX + Singulink = ♥

Search Results for

    Method AggregateRight

    AggregateRight<TSource>(IAsyncEnumerable<TSource>, Func<TSource, TSource, TSource>, CancellationToken)

    Applies a right-associative accumulator function over a sequence. This operator is the right-associative version of the Aggregate<TSource>(IEnumerable<TSource>, Func<TSource, TSource, TSource>) LINQ operator.

    Declaration
    public static ValueTask<TSource> AggregateRight<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, TSource, TSource> func, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IAsyncEnumerable<TSource> source

    Source sequence.

    Func<TSource, TSource, TSource> func

    A right-associative accumulator function to be invoked on each element.

    CancellationToken cancellationToken

    The optional cancellation token to be used for cancelling the sequence at any time.

    Returns
    Type Description
    ValueTask<TSource>

    The final accumulator value.

    Type Parameters
    Name Description
    TSource

    The type of the elements of source.

    Remarks

    This operator executes immediately.

    Examples
    string result = Enumerable.Range(1, 5).Select(i => i.ToString()).AggregateRight((a, b) => string.Format("({0}/{1})", a, b));

    The result variable will contain "(1/(2/(3/(4/5))))".

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentNullException

    func is null.

    AggregateRight<TSource>(IAsyncEnumerable<TSource>, Func<TSource, TSource, ValueTask<TSource>>, CancellationToken)

    Applies a right-associative accumulator function over a sequence. This operator is the right-associative version of the Aggregate<TSource>(IEnumerable<TSource>, Func<TSource, TSource, TSource>) LINQ operator.

    Declaration
    public static ValueTask<TSource> AggregateRight<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, TSource, ValueTask<TSource>> func, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IAsyncEnumerable<TSource> source

    Source sequence.

    Func<TSource, TSource, ValueTask<TSource>> func

    A right-associative accumulator function to be invoked on each element.

    CancellationToken cancellationToken

    The optional cancellation token to be used for cancelling the sequence at any time.

    Returns
    Type Description
    ValueTask<TSource>

    The final accumulator value.

    Type Parameters
    Name Description
    TSource

    The type of the elements of source.

    Remarks

    This operator executes immediately.

    Examples
    string result = Enumerable.Range(1, 5).Select(i => i.ToString()).AggregateRight((a, b) => string.Format("({0}/{1})", a, b));

    The result variable will contain "(1/(2/(3/(4/5))))".

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentNullException

    func is null.

    AggregateRight<TSource>(IAsyncEnumerable<TSource>, Func<TSource, TSource, CancellationToken, ValueTask<TSource>>, CancellationToken)

    Applies a right-associative accumulator function over a sequence. This operator is the right-associative version of the Aggregate<TSource>(IEnumerable<TSource>, Func<TSource, TSource, TSource>) LINQ operator.

    Declaration
    public static ValueTask<TSource> AggregateRight<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, TSource, CancellationToken, ValueTask<TSource>> func, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IAsyncEnumerable<TSource> source

    Source sequence.

    Func<TSource, TSource, CancellationToken, ValueTask<TSource>> func

    A right-associative accumulator function to be invoked on each element.

    CancellationToken cancellationToken

    The optional cancellation token to be used for cancelling the sequence at any time.

    Returns
    Type Description
    ValueTask<TSource>

    The final accumulator value.

    Type Parameters
    Name Description
    TSource

    The type of the elements of source.

    Remarks

    This operator executes immediately.

    Examples
    string result = Enumerable.Range(1, 5).Select(i => i.ToString()).AggregateRight((a, b) => string.Format("({0}/{1})", a, b));

    The result variable will contain "(1/(2/(3/(4/5))))".

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentNullException

    func is null.

    AggregateRight<TSource, TAccumulate>(IAsyncEnumerable<TSource>, TAccumulate, Func<TSource, TAccumulate, TAccumulate>, CancellationToken)

    Applies a right-associative accumulator function over a sequence. The specified seed value is used as the initial accumulator value. This operator is the right-associative version of the Aggregate<TSource, TAccumulate>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>) LINQ operator.

    Declaration
    public static ValueTask<TAccumulate> AggregateRight<TSource, TAccumulate>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TSource, TAccumulate, TAccumulate> func, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IAsyncEnumerable<TSource> source

    Source sequence.

    TAccumulate seed

    The initial accumulator value.

    Func<TSource, TAccumulate, TAccumulate> func

    A right-associative accumulator function to be invoked on each element.

    CancellationToken cancellationToken

    The optional cancellation token to be used for cancelling the sequence at any time.

    Returns
    Type Description
    ValueTask<TAccumulate>

    The final accumulator value.

    Type Parameters
    Name Description
    TSource

    The type of the elements of source.

    TAccumulate

    The type of the accumulator value.

    Remarks

    This operator executes immediately.

    Examples
    var numbers = Enumerable.Range(1, 5);
    string result = numbers.AggregateRight("6", (a, b) => string.Format("({0}/{1})", a, b));

    The result variable will contain "(1/(2/(3/(4/(5/6)))))".

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentNullException

    func is null.

    AggregateRight<TSource, TAccumulate>(IAsyncEnumerable<TSource>, TAccumulate, Func<TSource, TAccumulate, ValueTask<TAccumulate>>, CancellationToken)

    Applies a right-associative accumulator function over a sequence. The specified seed value is used as the initial accumulator value. This operator is the right-associative version of the Aggregate<TSource, TAccumulate>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>) LINQ operator.

    Declaration
    public static ValueTask<TAccumulate> AggregateRight<TSource, TAccumulate>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TSource, TAccumulate, ValueTask<TAccumulate>> func, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IAsyncEnumerable<TSource> source

    Source sequence.

    TAccumulate seed

    The initial accumulator value.

    Func<TSource, TAccumulate, ValueTask<TAccumulate>> func

    A right-associative accumulator function to be invoked on each element.

    CancellationToken cancellationToken

    The optional cancellation token to be used for cancelling the sequence at any time.

    Returns
    Type Description
    ValueTask<TAccumulate>

    The final accumulator value.

    Type Parameters
    Name Description
    TSource

    The type of the elements of source.

    TAccumulate

    The type of the accumulator value.

    Remarks

    This operator executes immediately.

    Examples
    var numbers = Enumerable.Range(1, 5);
    string result = numbers.AggregateRight("6", (a, b) => string.Format("({0}/{1})", a, b));

    The result variable will contain "(1/(2/(3/(4/(5/6)))))".

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentNullException

    func is null.

    AggregateRight<TSource, TAccumulate>(IAsyncEnumerable<TSource>, TAccumulate, Func<TSource, TAccumulate, CancellationToken, ValueTask<TAccumulate>>, CancellationToken)

    Applies a right-associative accumulator function over a sequence. The specified seed value is used as the initial accumulator value. This operator is the right-associative version of the Aggregate<TSource, TAccumulate>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>) LINQ operator.

    Declaration
    public static ValueTask<TAccumulate> AggregateRight<TSource, TAccumulate>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TSource, TAccumulate, CancellationToken, ValueTask<TAccumulate>> func, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IAsyncEnumerable<TSource> source

    Source sequence.

    TAccumulate seed

    The initial accumulator value.

    Func<TSource, TAccumulate, CancellationToken, ValueTask<TAccumulate>> func

    A right-associative accumulator function to be invoked on each element.

    CancellationToken cancellationToken

    The optional cancellation token to be used for cancelling the sequence at any time.

    Returns
    Type Description
    ValueTask<TAccumulate>

    The final accumulator value.

    Type Parameters
    Name Description
    TSource

    The type of the elements of source.

    TAccumulate

    The type of the accumulator value.

    Remarks

    This operator executes immediately.

    Examples
    var numbers = Enumerable.Range(1, 5);
    string result = numbers.AggregateRight("6", (a, b) => string.Format("({0}/{1})", a, b));

    The result variable will contain "(1/(2/(3/(4/(5/6)))))".

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentNullException

    func is null.

    AggregateRight<TSource, TAccumulate, TResult>(IAsyncEnumerable<TSource>, TAccumulate, Func<TSource, TAccumulate, TAccumulate>, Func<TAccumulate, TResult>, CancellationToken)

    Applies a right-associative accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value. This operator is the right-associative version of the Aggregate<TSource, TAccumulate, TResult>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>, Func<TAccumulate, TResult>) LINQ operator.

    Declaration
    public static ValueTask<TResult> AggregateRight<TSource, TAccumulate, TResult>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TSource, TAccumulate, TAccumulate> func, Func<TAccumulate, TResult> resultSelector, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IAsyncEnumerable<TSource> source

    Source sequence.

    TAccumulate seed

    The initial accumulator value.

    Func<TSource, TAccumulate, TAccumulate> func

    A right-associative accumulator function to be invoked on each element.

    Func<TAccumulate, TResult> resultSelector

    A function to transform the final accumulator value into the result value.

    CancellationToken cancellationToken

    The optional cancellation token to be used for cancelling the sequence at any time.

    Returns
    Type Description
    ValueTask<TResult>

    The transformed final accumulator value.

    Type Parameters
    Name Description
    TSource

    The type of the elements of source.

    TAccumulate

    The type of the accumulator value.

    TResult

    The type of the resulting value.

    Remarks

    This operator executes immediately.

    Examples
    var numbers = Enumerable.Range(1, 5);
    int result = numbers.AggregateRight("6", (a, b) => string.Format("({0}/{1})", a, b), str => str.Length);

    The result variable will contain 21.

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentNullException

    func is null.

    ArgumentNullException

    resultSelector is null.

    AggregateRight<TSource, TAccumulate, TResult>(IAsyncEnumerable<TSource>, TAccumulate, Func<TSource, TAccumulate, ValueTask<TAccumulate>>, Func<TAccumulate, ValueTask<TResult>>, CancellationToken)

    Applies a right-associative accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value. This operator is the right-associative version of the Aggregate<TSource, TAccumulate, TResult>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>, Func<TAccumulate, TResult>) LINQ operator.

    Declaration
    public static ValueTask<TResult> AggregateRight<TSource, TAccumulate, TResult>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TSource, TAccumulate, ValueTask<TAccumulate>> func, Func<TAccumulate, ValueTask<TResult>> resultSelector, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IAsyncEnumerable<TSource> source

    Source sequence.

    TAccumulate seed

    The initial accumulator value.

    Func<TSource, TAccumulate, ValueTask<TAccumulate>> func

    A right-associative accumulator function to be invoked on each element.

    Func<TAccumulate, ValueTask<TResult>> resultSelector

    A function to transform the final accumulator value into the result value.

    CancellationToken cancellationToken

    The optional cancellation token to be used for cancelling the sequence at any time.

    Returns
    Type Description
    ValueTask<TResult>

    The transformed final accumulator value.

    Type Parameters
    Name Description
    TSource

    The type of the elements of source.

    TAccumulate

    The type of the accumulator value.

    TResult

    The type of the resulting value.

    Remarks

    This operator executes immediately.

    Examples
    var numbers = Enumerable.Range(1, 5);
    int result = numbers.AggregateRight("6", (a, b) => string.Format("({0}/{1})", a, b), str => str.Length);

    The result variable will contain 21.

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentNullException

    func is null.

    ArgumentNullException

    resultSelector is null.

    AggregateRight<TSource, TAccumulate, TResult>(IAsyncEnumerable<TSource>, TAccumulate, Func<TSource, TAccumulate, CancellationToken, ValueTask<TAccumulate>>, Func<TAccumulate, CancellationToken, ValueTask<TResult>>, CancellationToken)

    Applies a right-associative accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value. This operator is the right-associative version of the Aggregate<TSource, TAccumulate, TResult>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>, Func<TAccumulate, TResult>) LINQ operator.

    Declaration
    public static ValueTask<TResult> AggregateRight<TSource, TAccumulate, TResult>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TSource, TAccumulate, CancellationToken, ValueTask<TAccumulate>> func, Func<TAccumulate, CancellationToken, ValueTask<TResult>> resultSelector, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IAsyncEnumerable<TSource> source

    Source sequence.

    TAccumulate seed

    The initial accumulator value.

    Func<TSource, TAccumulate, CancellationToken, ValueTask<TAccumulate>> func

    A right-associative accumulator function to be invoked on each element.

    Func<TAccumulate, CancellationToken, ValueTask<TResult>> resultSelector

    A function to transform the final accumulator value into the result value.

    CancellationToken cancellationToken

    The optional cancellation token to be used for cancelling the sequence at any time.

    Returns
    Type Description
    ValueTask<TResult>

    The transformed final accumulator value.

    Type Parameters
    Name Description
    TSource

    The type of the elements of source.

    TAccumulate

    The type of the accumulator value.

    TResult

    The type of the resulting value.

    Remarks

    This operator executes immediately.

    Examples
    var numbers = Enumerable.Range(1, 5);
    int result = numbers.AggregateRight("6", (a, b) => string.Format("({0}/{1})", a, b), str => str.Length);

    The result variable will contain 21.

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentNullException

    func is null.

    ArgumentNullException

    resultSelector is null.

    © SuperLinq Authors. All rights reserved.