Skip to content

)}

ObservableAsync.Cast(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> Cast<T, TResult>(this IObservableAsync<T> @this)

View source

Summary: Projects each element of the observable sequence to the specified result type by performing a runtime cast.

Type parameters

NameDescription
TThe type of elements in the source sequence.
TResultThe type to which the elements of the sequence are cast.

Parameters

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

Returns: IObservableAsync -- An observable sequence whose elements are the result of casting each element of the source sequence to TResult.

Remarks

If an element in the source sequence cannot be cast to TResult, the sequence completes with a failure containing the exception. This method is useful for working with sequences of objects when the actual element type is known at runtime.