SuperLinq SuperLinq
SuperLinq SuperLinq
DocFX + Singulink = ♥

Search Results for

    Method ScanRight

    ScanRight<TSource>(IAsyncEnumerable<TSource>, Func<TSource, TSource, TSource>)

    Performs a right-associative scan (inclusive prefix) on a sequence of elements. This operator is the right-associative version of the Scan<TSource>(IAsyncEnumerable<TSource>, Func<TSource, TSource, TSource>) LINQ operator.

    Declaration
    public static IAsyncEnumerable<TSource> ScanRight<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, TSource, TSource> func)
    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. Its first argument is the current value in the sequence; second argument is the previous accumulator value.

    Returns
    Type Description
    IAsyncEnumerable<TSource>

    The scanned sequence.

    Type Parameters
    Name Description
    TSource

    Type of elements in source sequence.

    Remarks

    This operator uses deferred execution and streams its results. Source sequence is consumed greedily when an iteration of the resulting sequence begins.

    Examples
    var result = Enumerable.Range(1, 5).Select(i => i.ToString()).ScanRight((a, b) => $"({a}+{b})");

    The result variable will contain [ "(1+(2+(3+(4+5))))", "(2+(3+(4+5)))", "(3+(4+5))", "(4+5)", "5" ].

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentNullException

    func is null.

    ScanRight<TSource>(IAsyncEnumerable<TSource>, Func<TSource, TSource, ValueTask<TSource>>)

    Performs a right-associative scan (inclusive prefix) on a sequence of elements. This operator is the right-associative version of the Scan<TSource>(IAsyncEnumerable<TSource>, Func<TSource, TSource, TSource>) LINQ operator.

    Declaration
    public static IAsyncEnumerable<TSource> ScanRight<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, TSource, ValueTask<TSource>> func)
    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. Its first argument is the current value in the sequence; second argument is the previous accumulator value.

    Returns
    Type Description
    IAsyncEnumerable<TSource>

    The scanned sequence.

    Type Parameters
    Name Description
    TSource

    Type of elements in source sequence.

    Remarks

    This operator uses deferred execution and streams its results. Source sequence is consumed greedily when an iteration of the resulting sequence begins.

    Examples
    var result = Enumerable.Range(1, 5).Select(i => i.ToString()).ScanRight((a, b) => $"({a}+{b})");

    The result variable will contain [ "(1+(2+(3+(4+5))))", "(2+(3+(4+5)))", "(3+(4+5))", "(4+5)", "5" ].

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentNullException

    func is null.

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

    Performs a right-associative scan (inclusive prefix) on a sequence of elements. This operator is the right-associative version of the Scan<TSource>(IAsyncEnumerable<TSource>, Func<TSource, TSource, TSource>) LINQ operator.

    Declaration
    public static IAsyncEnumerable<TSource> ScanRight<TSource>(this IAsyncEnumerable<TSource> source, Func<TSource, TSource, CancellationToken, ValueTask<TSource>> func)
    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. Its first argument is the current value in the sequence; second argument is the previous accumulator value.

    Returns
    Type Description
    IAsyncEnumerable<TSource>

    The scanned sequence.

    Type Parameters
    Name Description
    TSource

    Type of elements in source sequence.

    Remarks

    This operator uses deferred execution and streams its results. Source sequence is consumed greedily when an iteration of the resulting sequence begins.

    Examples
    var result = Enumerable.Range(1, 5).Select(i => i.ToString()).ScanRight((a, b) => $"({a}+{b})");

    The result variable will contain [ "(1+(2+(3+(4+5))))", "(2+(3+(4+5)))", "(3+(4+5))", "(4+5)", "5" ].

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentNullException

    func is null.

    ScanRight<TSource, TAccumulate>(IAsyncEnumerable<TSource>, TAccumulate, Func<TSource, TAccumulate, TAccumulate>)

    Performs a right-associative scan (inclusive prefix) on a sequence of elements. The specified seed value is used as the initial accumulator value. This operator is the right-associative version of the Scan<TSource, TState>(IAsyncEnumerable<TSource>, TState, Func<TState, TSource, TState>) LINQ operator.

    Declaration
    public static IAsyncEnumerable<TAccumulate> ScanRight<TSource, TAccumulate>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TSource, TAccumulate, TAccumulate> func)
    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.

    Returns
    Type Description
    IAsyncEnumerable<TAccumulate>

    The scanned sequence.

    Type Parameters
    Name Description
    TSource

    The type of the elements of source.

    TAccumulate

    The type of the accumulator value.

    Remarks

    This operator uses deferred execution and streams its results. Source sequence is consumed greedily when an iteration of the resulting sequence begins.

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

    The result variable will contain [ "(1+(2+(3+(4+5))))", "(2+(3+(4+5)))", "(3+(4+5))", "(4+5)", "5" ].

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentNullException

    seed is null.

    ArgumentNullException

    func is null.

    ScanRight<TSource, TAccumulate>(IAsyncEnumerable<TSource>, TAccumulate, Func<TSource, TAccumulate, ValueTask<TAccumulate>>)

    Performs a right-associative scan (inclusive prefix) on a sequence of elements. The specified seed value is used as the initial accumulator value. This operator is the right-associative version of the Scan<TSource, TState>(IAsyncEnumerable<TSource>, TState, Func<TState, TSource, TState>) LINQ operator.

    Declaration
    public static IAsyncEnumerable<TAccumulate> ScanRight<TSource, TAccumulate>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TSource, TAccumulate, ValueTask<TAccumulate>> func)
    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.

    Returns
    Type Description
    IAsyncEnumerable<TAccumulate>

    The scanned sequence.

    Type Parameters
    Name Description
    TSource

    The type of the elements of source.

    TAccumulate

    The type of the accumulator value.

    Remarks

    This operator uses deferred execution and streams its results. Source sequence is consumed greedily when an iteration of the resulting sequence begins.

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

    The result variable will contain [ "(1+(2+(3+(4+5))))", "(2+(3+(4+5)))", "(3+(4+5))", "(4+5)", "5" ].

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentNullException

    seed is null.

    ArgumentNullException

    func is null.

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

    Performs a right-associative scan (inclusive prefix) on a sequence of elements. The specified seed value is used as the initial accumulator value. This operator is the right-associative version of the Scan<TSource, TState>(IAsyncEnumerable<TSource>, TState, Func<TState, TSource, TState>) LINQ operator.

    Declaration
    public static IAsyncEnumerable<TAccumulate> ScanRight<TSource, TAccumulate>(this IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TSource, TAccumulate, CancellationToken, ValueTask<TAccumulate>> func)
    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.

    Returns
    Type Description
    IAsyncEnumerable<TAccumulate>

    The scanned sequence.

    Type Parameters
    Name Description
    TSource

    The type of the elements of source.

    TAccumulate

    The type of the accumulator value.

    Remarks

    This operator uses deferred execution and streams its results. Source sequence is consumed greedily when an iteration of the resulting sequence begins.

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

    The result variable will contain [ "(1+(2+(3+(4+5))))", "(2+(3+(4+5)))", "(3+(4+5))", "(4+5)", "5" ].

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentNullException

    seed is null.

    ArgumentNullException

    func is null.

    © SuperLinq Authors. All rights reserved.