Share via

Observable.SelectMany<TSource, TResult> Method (IObservable<TSource>, Func<TSource, IObservable<TResult>>, Func<Exception, IObservable<TResult>>, Func<IObservable<TResult>>)

Projects each element of an observable sequence to an observable sequence and flattens the resulting observable sequences into one observable sequence.

Namespace:  System.Reactive.Linq
Assembly:  System.Reactive (in System.Reactive.dll)


<ExtensionAttribute> _
Public Shared Function SelectMany(Of TSource, TResult) ( _
    source As IObservable(Of TSource), _
    onNext As Func(Of TSource, IObservable(Of TResult)), _
    onError As Func(Of Exception, IObservable(Of TResult)), _
    onCompleted As Func(Of IObservable(Of TResult)) _
) As IObservable(Of TResult)
Dim source As IObservable(Of TSource)
Dim onNext As Func(Of TSource, IObservable(Of TResult))
Dim onError As Func(Of Exception, IObservable(Of TResult))
Dim onCompleted As Func(Of IObservable(Of TResult))
Dim returnValue As IObservable(Of TResult)

returnValue = source.SelectMany(onNext, _
    onError, onCompleted)
public static IObservable<TResult> SelectMany<TSource, TResult>(
    this IObservable<TSource> source,
    Func<TSource, IObservable<TResult>> onNext,
    Func<Exception, IObservable<TResult>> onError,
    Func<IObservable<TResult>> onCompleted
generic<typename TSource, typename TResult>
static IObservable<TResult>^ SelectMany(
    IObservable<TSource>^ source, 
    Func<TSource, IObservable<TResult>^>^ onNext, 
    Func<Exception^, IObservable<TResult>^>^ onError, 
    Func<IObservable<TResult>^>^ onCompleted
static member SelectMany : 
        source:IObservable<'TSource> * 
        onNext:Func<'TSource, IObservable<'TResult>> * 
        onError:Func<Exception, IObservable<'TResult>> * 
        onCompleted:Func<IObservable<'TResult>> -> IObservable<'TResult> 
JScript does not support generic types and methods.

Type Parameters

  • TSource
    The type of source.
  • TResult
    The type of result.


  • onCompleted
    Type: System.Func<IObservable<TResult>>
    A transform function to apply when the end of the source sequence is reached.

Return Value

Type: System.IObservable<TResult>
An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IObservable<TSource>. When you use instance method syntax to call this method, omit the first parameter. For more information, see or .

See Also


Observable Class

SelectMany Overload

System.Reactive.Linq Namespace