Method FallbackIfEmpty
FallbackIfEmpty<T>(IAsyncEnumerable<T>, params T[])
Returns the elements of a sequence, but if it is empty then returns an alternate sequence from an array of values.
Declaration
public static IAsyncEnumerable<T> FallbackIfEmpty<T>(this IAsyncEnumerable<T> source, params T[] fallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<T> | source | The source sequence. |
| T[] | fallback | The array that is returned as the alternate
sequence if |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<T> | An IAsyncEnumerable<T> that containing fallback values
if |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements in the sequences. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentNullException |
|
FallbackIfEmpty<T>(IAsyncEnumerable<T>, IEnumerable<T>)
Returns the elements of a sequence, but if it is empty then returns an alternate sequence from an array of values.
Declaration
public static IAsyncEnumerable<T> FallbackIfEmpty<T>(this IAsyncEnumerable<T> source, IEnumerable<T> fallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<T> | source | The source sequence. |
| IEnumerable<T> | fallback | The array that is returned as the alternate
sequence if |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<T> | An IAsyncEnumerable<T> that containing fallback values
if |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements in the sequences. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentNullException |
|
FallbackIfEmpty<T>(IAsyncEnumerable<T>, IAsyncEnumerable<T>)
Returns the elements of a sequence, but if it is empty then returns an alternate sequence of values.
Declaration
public static IAsyncEnumerable<T> FallbackIfEmpty<T>(this IAsyncEnumerable<T> source, IAsyncEnumerable<T> fallback)
Parameters
| Type | Name | Description |
|---|---|---|
| IAsyncEnumerable<T> | source | The source sequence. |
| IAsyncEnumerable<T> | fallback | The alternate sequence that is returned
if |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<T> | An IAsyncEnumerable<T> that containing fallback values
if |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements in the sequences. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentNullException |
|