Qbservable.DefaultIfEmpty(IQbservable) method¶
Defined in
Type: Qbservable
Namespace: System.Reactive.Linq
Assembly: System.Reactive.dll
Applies to
netstandard2.0
Overloads¶
- 1.
public static IQbservable<TSource?> DefaultIfEmpty<TSource>(this IQbservable<TSource> source) - 2.
public static IQbservable<TSource> DefaultIfEmpty<TSource>(this IQbservable<TSource> source, TSource defaultValue)
1. Overload¶
public static IQbservable<TSource?> DefaultIfEmpty<TSource>(this IQbservable<TSource> source)
Summary: Returns the elements of the specified sequence or the type parameter's default value in a singleton sequence if the sequence is empty.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence (if any), whose default value will be taken if the sequence is empty. |
Parameters
| Name | Type | Description |
|---|---|---|
source | [IQbservable | The sequence to return a default value for if it is empty. |
Returns: IQbservable
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source is null. |
2. Overload¶
public static IQbservable<TSource> DefaultIfEmpty<TSource>(this IQbservable<TSource> source, TSource defaultValue)
Summary: Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence (if any), and the specified default value which will be taken if the sequence is empty. |
Parameters
| Name | Type | Description |
|---|---|---|
source | [IQbservable | The sequence to return the specified value for if it is empty. |
defaultValue | TSource | The value to return if the sequence is empty. |
Returns: IQbservable
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source is null. |