SuperLinq SuperLinq
SuperLinq SuperLinq
DocFX + Singulink = ♥

Search Results for

    Method CountBetween

    CountBetween<T>(IAsyncEnumerable<T>, int, int, CancellationToken)

    Determines whether or not the number of elements in the sequence is between an inclusive range of minimum and maximum integers.

    Declaration
    public static ValueTask<bool> CountBetween<T>(this IAsyncEnumerable<T> source, int min, int max, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IAsyncEnumerable<T> source

    The source sequence

    int min

    The minimum number of items a sequence must have for this function to return true

    int max

    The maximum number of items a sequence must have for this function to return true

    CancellationToken cancellationToken

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

    Returns
    Type Description
    ValueTask<bool>

    true if the number of elements in the sequence is between (inclusive) the min and max given integers or false otherwise.

    Type Parameters
    Name Description
    T

    Element type of sequence

    Examples
    var numbers = new[] { 123, 456, 789 };
    var result = numbers.CountBetween(1, 2);

    The result variable will contain false.

    Exceptions
    Type Condition
    ArgumentNullException

    source is null

    ArgumentOutOfRangeException

    min is negative or max is less than min

    © SuperLinq Authors. All rights reserved.