Method AtLeast
AtLeast<T>(IAsyncEnumerable<T>, int, CancellationToken)
Determines whether or not the number of elements in the sequence is greater than or equal to the given integer.
Declaration
public static ValueTask<bool> AtLeast<T>(this IAsyncEnumerable<T> source, int count, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<T> | source | The source sequence |
| int | count | The minimum 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 greater than or equal 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.AtLeast(2);
The result variable will contain true.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentOutOfRangeException |
|