Method Throw
View SourceThrow<TSource>(Exception)
Returns a sequence that throws an exception upon enumeration.
Declaration
public static IAsyncEnumerable<TSource> Throw<TSource>(Exception exception)
Parameters
Type | Name | Description |
---|---|---|
Exception | exception | Exception to throw upon enumerating the resulting sequence. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TSource> | Sequence that throws the specified exception upon enumeration. |
Type Parameters
Name | Description |
---|---|
TSource | Source sequence element type. |
Remarks
The provided value (exception
) will be thrown when the first element is enumerated.
If the returned IAsyncEnumerable<T> is enumerated multiple times, the same value will be thrown each time.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|