SuperLinq SuperLinq
SuperLinq SuperLinq
DocFX + Singulink = ♥

Search Results for

    Method CompareCount

    CompareCount<TFirst, TSecond>(IAsyncEnumerable<TFirst>, IAsyncEnumerable<TSecond>, CancellationToken)

    Compares two sequences and returns an integer that indicates whether the first sequence has fewer, the same or more elements than the second sequence.

    Declaration
    public static ValueTask<int> CompareCount<TFirst, TSecond>(this IAsyncEnumerable<TFirst> first, IAsyncEnumerable<TSecond> second, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IAsyncEnumerable<TFirst> first

    The first sequence

    IAsyncEnumerable<TSecond> second

    The second sequence

    CancellationToken cancellationToken

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

    Returns
    Type Description
    ValueTask<int>

    -1 if the first sequence has the fewest elements, 0 if the two sequences have the same number of elements or 1 if the first sequence has the most elements.

    Type Parameters
    Name Description
    TFirst

    Element type of the first sequence

    TSecond

    Element type of the second sequence

    Examples
    var first = new[] { 123, 456 };
    var second = new[] { 789 };
    var result = first.CompareCount(second);

    The result variable will contain 1.

    Exceptions
    Type Condition
    ArgumentNullException

    first is null

    ArgumentNullException

    second is null

    © SuperLinq Authors. All rights reserved.