Skip to content

)}

ObservableAsync.OfType(IObservableAsync) method

Defined in

Type: ObservableAsync Namespace: ReactiveUI.Extensions.Async Assembly: ReactiveUI.Extensions.dll

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<TResult> OfType<T, TResult>(this IObservableAsync<T> @this) where TResult : class

View source

Summary: Projects each element of the observable sequence to the specified reference type and filters out elements that are not of that type.

Type parameters

NameDescription
TThe type of elements in the source sequence.
TResultThe reference type to filter and project elements to. Must be a class.

Parameters

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

Returns: IObservableAsync -- An observable sequence containing only the elements of type TResult from the original sequence.

Remarks

Elements that are not of type TResult are ignored and not included in the resulting sequence. This method is useful for working with observable sequences containing heterogeneous types, allowing subscribers to focus on elements of a specific type.