Skip to content

Applies to

net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481

public static IObservableAsync<T> Switch<T>(this IObservableAsync<IObservableAsync<T>> @this)

View source

Summary: Transforms an observable sequence of observable sequences into a single observable sequence that emits values from the most recent inner observable sequence.

Type parameters

NameDescription
TThe type of the elements in the inner observable sequences.

Parameters

NameTypeDescription
this[IObservableAsync>](#The source observable sequence of observable sequences.

Returns: IObservableAsync -- An observable sequence that emits items from the most recently emitted inner observable sequence. When a new inner sequence is emitted, the previous one is unsubscribed.

Remarks

This operator is commonly used to switch to a new data stream whenever a new inner observable is produced, unsubscribing from the previous inner observable. Only items from the latest inner observable are emitted to subscribers.