SuperLinq SuperLinq
SuperLinq SuperLinq
DocFX + Singulink = ♥

Search Results for

    Method Exactly

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

    Determines whether or not the number of elements in the sequence is equals to the given integer.

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

    The source sequence

    int count

    The exactly 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 equals to the given integer or false otherwise.

    Type Parameters
    Name Description
    T

    Element type of sequence

    Examples
    var numbers = new[] { 123, 456, 789 };
    var result = numbers.Exactly(3);

    The result variable will contain true.

    Exceptions
    Type Condition
    ArgumentNullException

    source is null

    ArgumentOutOfRangeException

    count is negative

    © SuperLinq Authors. All rights reserved.