Skip to content

},System.IObservable{--0})} },System.IObservable{--0},System.IObservable{--0})} },System.IObservable{--0},System.Reactive.Concurrency.IScheduler)}

Qbservable.If(IQbservableProvider, Expression>, IObservable) method

Defined in

Type: Qbservable Namespace: System.Reactive.Linq Assembly: System.Reactive.dll

Applies to

netstandard2.0

Overloads

  • 1. public static IQbservable<TResult> If<TResult>(this IQbservableProvider provider, Expression<Func<bool>> condition, IObservable<TResult> thenSource)
  • 2. public static IQbservable<TResult> If<TResult>(this IQbservableProvider provider, Expression<Func<bool>> condition, IObservable<TResult> thenSource, IObservable<TResult> elseSource)
  • 3. public static IQbservable<TResult> If<TResult>(this IQbservableProvider provider, Expression<Func<bool>> condition, IObservable<TResult> thenSource, IScheduler scheduler)

1. Overload

public static IQbservable<TResult> If<TResult>(this IQbservableProvider provider, Expression<Func<bool>> condition, IObservable<TResult> thenSource)

Summary: If the specified condition evaluates true, select the thenSource sequence. Otherwise, return an empty sequence.

Type parameters

NameDescription
TResultThe type of the elements in the result sequence.

Parameters

NameTypeDescription
provider[IQbservableProvider](#Query provider used to construct the [IQbservable](# data source.
conditionExpression>Condition evaluated to decide which sequence to return.
thenSourceIObservableSequence returned in case condition evaluates true.

Returns: IQbservable -- thenSource if condition evaluates true; an empty sequence otherwise.

Exceptions

TypeCondition
System.ArgumentNullExceptioncondition or thenSource is null.

2. Overload

public static IQbservable<TResult> If<TResult>(this IQbservableProvider provider, Expression<Func<bool>> condition, IObservable<TResult> thenSource, IObservable<TResult> elseSource)

Summary: If the specified condition evaluates true, select the thenSource sequence. Otherwise, select the elseSource sequence.

Type parameters

NameDescription
TResultThe type of the elements in the result sequence.

Parameters

NameTypeDescription
provider[IQbservableProvider](#Query provider used to construct the [IQbservable](# data source.
conditionExpression>Condition evaluated to decide which sequence to return.
thenSourceIObservableSequence returned in case condition evaluates true.
elseSourceIObservableSequence returned in case condition evaluates false.

Returns: IQbservable -- thenSource if condition evaluates true; elseSource otherwise.

Exceptions

TypeCondition
System.ArgumentNullExceptioncondition or thenSource or elseSource is null.

3. Overload

public static IQbservable<TResult> If<TResult>(this IQbservableProvider provider, Expression<Func<bool>> condition, IObservable<TResult> thenSource, IScheduler scheduler)

Summary: If the specified condition evaluates true, select the thenSource sequence. Otherwise, return an empty sequence generated on the specified scheduler.

Type parameters

NameDescription
TResultThe type of the elements in the result sequence.

Parameters

NameTypeDescription
provider[IQbservableProvider](#Query provider used to construct the [IQbservable](# data source.
conditionExpression>Condition evaluated to decide which sequence to return.
thenSourceIObservableSequence returned in case condition evaluates true.
scheduler[IScheduler](#Scheduler to generate an empty sequence on in case condition evaluates false.

Returns: IQbservable -- thenSource if condition evaluates true; an empty sequence otherwise.

Exceptions

TypeCondition
System.ArgumentNullExceptioncondition or thenSource or scheduler is null.