ObservableExtensions.

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

Summary

Projects each element of an observable sequence to an enumerable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.

Syntax

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

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, IEnumerable<TCollection>> A transform function to apply to each element.
resultSelector Func<TSource, TCollection, TResult> A transform function to apply to each element of the intermediate sequence.
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 collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.