ObservableExtensions.

MergeMap<TSource, TResult>(IObservable<TSource>, Func<TSource, int, IEnumerable<TResult>>, int) Method

Summary

Projects each element of an observable sequence to an enumerable sequence by incorporating the element's index and concatenates the resulting enumerable sequences into one observable sequence.

Syntax

public static IObservable<TResult> MergeMap<TSource, TResult>(this IObservable<TSource> source, Func<TSource, int, IEnumerable<TResult>> selector, int maxConcurrent)

Type Parameters

Name Description
TSource The type of the elements in the source sequence.
TResult The type of the elements in the projected inner enumerable sequences and the elements in the merged result sequence.

Parameters

Name Type Description
source IObservable<TSource> An observable sequence of elements to project.
selector Func<TSource, int, IEnumerable<TResult>> A transform function to apply to each element; the second parameter of the function represents the index of the source element.
maxConcurrent int Maximum number of inner observable sequences being subscribed to concurrently.

Return Value

Type Description
IObservable<TResult> An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.