ObservableExtensions.

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

Summary

Merges elements from all inner observable sequences into a single observable sequence, limiting the number of concurrent subscriptions to inner sequences.

Syntax

public static IObservable<TResult> MergeMap<TSource, TCollection, TResult>(this IObservable<TSource> source, Func<TSource, int, IEnumerable<TCollection>> collectionSelector, Func<TSource, int, TCollection, int, TResult> resultSelector)

Type Parameters

Name Description
TSource The type of the elements in the source sequence.
TCollection The type of the elements in the projected intermediate enumerable sequences.
TResult The type of the elements in the result sequence, obtained by using the selector to combine source sequence elements with their corresponding intermediate sequence elements.

Parameters

Name Type Description
source IObservable<TSource> An observable sequence of elements to project.
collectionSelector Func<TSource, int, IEnumerable<TCollection>> A transform function to apply to each element; the second parameter of the function represents the index of the source element.
resultSelector Func<TSource, int, TCollection, int, TResult> A transform function to apply to each element of the intermediate sequence; the second parameter of the function represents the index of the source element and the fourth parameter represents the index of the intermediate element.

Return Value

Type Description
IObservable<TResult> The observable sequence that merges the elements of the inner sequences.