SuperLinq SuperLinq
SuperLinq SuperLinq
DocFX + Singulink = ♥

Search Results for

    Method CollectionEqual

    CollectionEqual<TSource>(IAsyncEnumerable<TSource>, IAsyncEnumerable<TSource>, CancellationToken)

    Determines whether two collections are equal by comparing the elements by using the default equality comparer for their type.

    Declaration
    public static ValueTask<bool> CollectionEqual<TSource>(this IAsyncEnumerable<TSource> first, IAsyncEnumerable<TSource> second, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IAsyncEnumerable<TSource> first

    An IAsyncEnumerable<T> to compare to second.

    IAsyncEnumerable<TSource> second

    An IAsyncEnumerable<T> to compare to the first sequence.

    CancellationToken cancellationToken

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

    Returns
    Type Description
    ValueTask<bool>

    true if the two source sequences are of equal length and their corresponding elements are equal according to the default equality comparer for their type; otherwise, false.

    Type Parameters
    Name Description
    TSource

    The type of the elements of the input sequences.

    Remarks

    This method uses the default equality comparer for TSource, Default, to build a HashSet<T> of the items from first; and compares the collection to second using SetEquals(IEnumerable<T>).

    This method executes immediately.

    Exceptions
    Type Condition
    ArgumentNullException

    first is null.

    ArgumentNullException

    second is null.

    CollectionEqual<TSource>(IAsyncEnumerable<TSource>, IAsyncEnumerable<TSource>, IEqualityComparer<TSource>?, CancellationToken)

    Determines whether two collections are equal by comparing the elements by using a specified IEqualityComparer<T>.

    Declaration
    public static ValueTask<bool> CollectionEqual<TSource>(this IAsyncEnumerable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource>? comparer, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IAsyncEnumerable<TSource> first

    An IAsyncEnumerable<T> to compare to second.

    IAsyncEnumerable<TSource> second

    An IAsyncEnumerable<T> to compare to the first sequence.

    IEqualityComparer<TSource> comparer

    An IEqualityComparer<T> to use to compare elements.

    CancellationToken cancellationToken

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

    Returns
    Type Description
    ValueTask<bool>

    true if the two source sequences are of equal length and their corresponding elements are equal according to the default equality comparer for their type; otherwise, false.

    Type Parameters
    Name Description
    TSource

    The type of the elements of the input sequences.

    Remarks

    This method uses the provided equality comparer for TSource to build a HashSet<T> of the items from first; and compares the collection to second using SetEquals(IEnumerable<T>). If comparer is null, the default equality comparer, Default, is used.

    This method executes immediately.

    Exceptions
    Type Condition
    ArgumentNullException

    first is null.

    ArgumentNullException

    second is null.

    © SuperLinq Authors. All rights reserved.