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> |
|
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 |
|
| ArgumentNullException |
|