Class SwitchMapToOperator
Extension methods implementing the switchMapTo operator.
public static class SwitchMapToOperator
- Inheritance
-
System.ObjectSwitchMapToOperator
Methods
SwitchMapTo<TSource, TResult>(Observable<TSource>, Observable<TResult>)
Projects every value from source to the same innerObservable,
regardless of the source value, switching to a fresh subscription every time source
emits (tearing down the previous one, even if still active). Equivalent to
source.SwitchMap(_ => innerObservable).
public static Observable<TResult> SwitchMapTo<TSource, TResult>(this Observable<TSource> source, Observable<TResult> innerObservable)
Parameters
sourceObservable<TSource>The source sequence.
innerObservableObservable<TResult>The observable to switch to for every value emitted by
source.
Returns
- Observable<TResult>
An observable that emits the values of only the most recent subscription to
innerObservable.
Type Parameters
TSourceThe type of values emitted by
source.TResultThe type of values emitted by
innerObservable.
Remarks
Marked @deprecated upstream (in favor of switchMap(() => result)) but still present in rxjs
7.8.2, so it is ported here too. Like SwitchMapOperator, this does not port rxjs's deprecated
resultSelector parameter — apply .Map(...) to the result for a projection.