Table of Contents

Class ConcatMapOperator

Namespace
RxSharp.Operators
Assembly
RxSharp.dll

Implements the ConcatMap operator. Mirrors rxjs's concatMap.

public static class ConcatMapOperator
Inheritance
System.Object
ConcatMapOperator

Methods

ConcatMap<TSource, TResult>(Observable<TSource>, Func<TSource, Observable<TResult>>)

Projects each source value into an inner observable via project, and concatenates the resulting inner observables in order: the next inner observable is only subscribed to once the previous one has completed, so their emitted values are never interleaved.

public static Observable<TResult> ConcatMap<TSource, TResult>(this Observable<TSource> source, Func<TSource, Observable<TResult>> project)

Parameters

source Observable<TSource>

The source observable whose values are projected.

project Func<TSource, Observable<TResult>>

A function that maps each source value to an inner observable.

Returns

Observable<TResult>

An observable of the concatenated values from each inner observable, in source order.

Type Parameters

TSource

The element type of the source observable.

TResult

The element type produced by the inner observables.

Remarks

Equivalent to the indexed overload with the index ignored.

ConcatMap<TSource, TResult>(Observable<TSource>, Func<TSource, int, Observable<TResult>>)

Projects each source value (together with its zero-based processing index) into an inner observable via project, and subscribes to the inner observables one at a time, in the order their source values arrived.

public static Observable<TResult> ConcatMap<TSource, TResult>(this Observable<TSource> source, Func<TSource, int, Observable<TResult>> project)

Parameters

source Observable<TSource>

The source observable whose values are projected.

project Func<TSource, int, Observable<TResult>>

A function that maps each source value and its processing index to an inner observable.

Returns

Observable<TResult>

An observable of the concatenated values from each inner observable, in source order.

Type Parameters

TSource

The element type of the source observable.

TResult

The element type produced by the inner observables.

Remarks

Source values that arrive while an inner observable is still active are queued rather than dropped: the next queued value is only projected and subscribed to once the current inner observable completes, preserving strict FIFO order. If project throws, or an inner observable errors, the error is forwarded via OnError and no further inner observables are subscribed to. Completion is forwarded only once source has completed and every queued inner observable has completed.