Observable

Observable.Switch<TSource> Method

Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

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

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function Switch(Of TSource) ( _
    sources As IObservable(Of IObservable(Of TSource)) _
) As IObservable(Of TSource)
'Usage
Dim sources As IObservable(Of IObservable(Of TSource))
Dim returnValue As IObservable(Of TSource)

returnValue = sources.Switch()
public static IObservable<TSource> Switch<TSource>(
    this IObservable<IObservable<TSource>> sources
)
[ExtensionAttribute]
public:
generic<typename TSource>
static IObservable<TSource>^ Switch(
    IObservable<IObservable<TSource>^>^ sources
)
static member Switch : 
        sources:IObservable<IObservable<'TSource>> -> IObservable<'TSource> 
JScript does not support generic types and methods.

Type Parameters

  • TSource
    The type of source.

Parameters

Return Value

Type: System.IObservable<TSource>
The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.

Usage Note

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

See Also

Reference

Observable Class

System.Reactive.Linq Namespace