SuperLinq SuperLinq
SuperLinq SuperLinq
DocFX + Singulink = ♥

Search Results for

    Method CountDown

    CountDown<TSource>(IAsyncEnumerable<TSource>, int)

    Provides a countdown counter for a given count of elements at the tail of the sequence where zero always represents the last element, one represents the second-last element, two represents the third-last element and so on.

    Declaration
    public static IAsyncEnumerable<(TSource item, int? count)> CountDown<TSource>(this IAsyncEnumerable<TSource> source, int count)
    Parameters
    Type Name Description
    IAsyncEnumerable<TSource> source

    The source sequence.

    int count

    Count of tail elements of source to count down.

    Returns
    Type Description
    IAsyncEnumerable<(TSource item, int? count)>

    A sequence of tuples of the element and it's count from the end of the sequence.

    Type Parameters
    Name Description
    TSource

    The type of elements of source

    Remarks

    This method uses deferred execution semantics and streams its results. At most, count elements of the source sequence may be buffered at any one time unless source is a collection or a list.

    This operator executes immediately.

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentOutOfRangeException

    count is 0 or negative.

    CountDown<TSource, TResult>(IAsyncEnumerable<TSource>, int, Func<TSource, int?, TResult>)

    Provides a countdown counter for a given count of elements at the tail of the sequence where zero always represents the last element, one represents the second-last element, two represents the third-last element and so on.

    Declaration
    public static IAsyncEnumerable<TResult> CountDown<TSource, TResult>(this IAsyncEnumerable<TSource> source, int count, Func<TSource, int?, TResult> resultSelector)
    Parameters
    Type Name Description
    IAsyncEnumerable<TSource> source

    The source sequence.

    int count

    Count of tail elements of source to count down.

    Func<TSource, int?, TResult> resultSelector

    A function that receives the element and the current countdown value for the element and which returns those mapped to a result returned in the resulting sequence. For elements before the last count, the countdown value is null.

    Returns
    Type Description
    IAsyncEnumerable<TResult>

    A sequence of results returned by resultSelector.

    Type Parameters
    Name Description
    TSource

    The type of elements of source

    TResult

    The type of elements of the resulting sequence.

    Remarks

    This method uses deferred execution semantics and streams its results. At most, count elements of the source sequence may be buffered at any one time unless source is a collection or a list.

    This operator executes immediately.

    Exceptions
    Type Condition
    ArgumentNullException

    source or resultSelector is null.

    ArgumentOutOfRangeException

    count is 0 or negative.

    © SuperLinq Authors. All rights reserved.