Class AsyncEnumerableExtensions
Extensions for all items of type IAsyncEnumerable<T>.
Inherited Members
Namespace: TheXDS.MCART.Types.Extensions
Assembly: MCART.dll
Syntax
public static class AsyncEnumerableExtensions
Methods
| Edit this page View SourceCountAsync<T>(IAsyncEnumerable<T>)
Gets the count of items from an IAsyncEnumerable<T>, enumerating it asynchronously.
Declaration
public static ValueTask<int> CountAsync<T>(this IAsyncEnumerable<T> e)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<T> | e | IAsyncEnumerable<T> for which to get the count of items. |
Returns
Type | Description |
---|---|
ValueTask<int> | The number of items contained in the collection. |
Type Parameters
Name | Description |
---|---|
T | Type of items in the collection. |
Exceptions
Type | Condition |
---|---|
TaskCanceledException | Occurs when the task is cancelled. |
CountAsync<T>(IAsyncEnumerable<T>, CancellationToken)
Gets the count of items from an IAsyncEnumerable<T>, enumerating it asynchronously.
Declaration
public static ValueTask<int> CountAsync<T>(this IAsyncEnumerable<T> e, CancellationToken ct)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<T> | e | IAsyncEnumerable<T> for which to get the count of items. |
CancellationToken | ct | Token that allows cancellation of the operation. |
Returns
Type | Description |
---|---|
ValueTask<int> | The number of items contained in the collection. |
Type Parameters
Name | Description |
---|---|
T | Type of items in the collection. |
Exceptions
Type | Condition |
---|---|
TaskCanceledException | Occurs when the task is cancelled. |