Method Retry
Retry<TSource>(IAsyncEnumerable<TSource>)
Creates a sequence that retries enumerating the source sequence as long as an error occurs.
Declaration
public static IAsyncEnumerable<TSource> Retry<TSource>(this IAsyncEnumerable<TSource> source)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<TSource> | source | Source sequence. |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<TSource> | Sequence concatenating the results of the source sequence as long as an error occurs. |
Type Parameters
| Name | Description |
|---|---|
| TSource | Source sequence element type. |
Remarks
source will be enumerated and values streamed until it either completes or encounters an
error. If an error is thrown, then source will be re-enumerated from the beginning. This will
happen until an iteration of source has completed without errors.
This method uses deferred execution and streams its results.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
Retry<TSource>(IAsyncEnumerable<TSource>, int)
Creates a sequence that retries enumerating the source sequence as long as an error occurs, with the specified maximum number of retries.
Declaration
public static IAsyncEnumerable<TSource> Retry<TSource>(this IAsyncEnumerable<TSource> source, int count)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<TSource> | source | Source sequence. |
| int | count | Maximum number of retries. |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<TSource> | Sequence concatenating the results of the source sequence as long as an error occurs. |
Type Parameters
| Name | Description |
|---|---|
| TSource | Source sequence element type. |
Remarks
source will be enumerated and values streamed until it either completes or encounters an
error. If an error is thrown, then source will be re-enumerated from the beginning. This will
happen until an iteration of source has completed without errors, or source has been enumerated count times. If an error is thrown during the final
iteration, it will not be caught and will be thrown to the consumer.
This method uses deferred execution and streams its results.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentOutOfRangeException |
|