Skip to content

,System.Threading.CancellationToken)} ,System.Threading.CancellationToken)}

Observable.RunAsync(IObservable, CancellationToken) method

Defined in

Type: Observable Namespace: System.Reactive.Linq Assembly: System.Reactive.dll

Applies to

netstandard2.0

Overloads

  • 1. public static AsyncSubject<TSource> RunAsync<TSource>(this IObservable<TSource> source, CancellationToken cancellationToken)
  • 2. public static AsyncSubject<TSource> RunAsync<TSource>(this IConnectableObservable<TSource> source, CancellationToken cancellationToken)

1. Overload

public static AsyncSubject<TSource> RunAsync<TSource>(this IObservable<TSource> source, CancellationToken cancellationToken)

Summary: Gets an awaiter that returns the last value of the observable sequence or throws an exception if the sequence is empty. This operation subscribes to the observable sequence, making it hot. The supplied CancellationToken can be used to cancel the subscription.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
sourceIObservableSource sequence to await.
cancellationTokenCancellationTokenCancellation token.

Returns: AsyncSubject -- Object that can be awaited.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource is null.

2. Overload

public static AsyncSubject<TSource> RunAsync<TSource>(this IConnectableObservable<TSource> source, CancellationToken cancellationToken)

Summary: Gets an awaiter that returns the last value of the observable sequence or throws an exception if the sequence is empty. This operation subscribes and connects to the observable sequence, making it hot. The supplied CancellationToken can be used to cancel the subscription and connection.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
source[IConnectableObservable](#Source sequence to await.
cancellationTokenCancellationTokenCancellation token.

Returns: AsyncSubject -- Object that can be awaited.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource is null.