Skip to content

,System.Threading.SynchronizationContext)} ,System.Reactive.Concurrency.IScheduler)}

Qbservable.SubscribeOn(IQbservable, SynchronizationContext) method

Defined in

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

Applies to

netstandard2.0

Overloads

  • 1. public static IQbservable<TSource> SubscribeOn<TSource>(this IQbservable<TSource> source, SynchronizationContext context)
  • 2. public static IQbservable<TSource> SubscribeOn<TSource>(this IQbservable<TSource> source, IScheduler scheduler)

1. Overload

public static IQbservable<TSource> SubscribeOn<TSource>(this IQbservable<TSource> source, SynchronizationContext context)

Summary: Wraps the source sequence in order to run its subscription and unsubscription logic on the specified synchronization context. This operation is not commonly used; see the remarks section for more information on the distinction between SubscribeOn and ObserveOn.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence.
contextSynchronizationContextSynchronization context to perform subscription and unsubscription actions on.

Returns: IQbservable -- The source sequence whose subscriptions and unsubscriptions happen on the specified synchronization context.

Remarks

This only performs the side-effects of subscription and unsubscription on the specified synchronization context. In order to invoke observer callbacks on a synchronization context, use ObserveOn.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or context is null.

2. Overload

public static IQbservable<TSource> SubscribeOn<TSource>(this IQbservable<TSource> source, IScheduler scheduler)

Summary: Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used; see the remarks section for more information on the distinction between SubscribeOn and ObserveOn.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence.
scheduler[IScheduler](#Scheduler to perform subscription and unsubscription actions on.

Returns: IQbservable -- The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.

Remarks

This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer callbacks on a scheduler, use ObserveOn.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or scheduler is null.