,System.Reactive.Concurrency.IScheduler)} ,System.Threading.SynchronizationContext)}
Observable.SubscribeOn(IObservable, IScheduler) method¶
Defined in
Type: Observable
Namespace: System.Reactive.Linq
Assembly: System.Reactive.dll
Applies to
netstandard2.0
Overloads¶
- 1.
public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, IScheduler scheduler) - 2.
public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<TSource> source, SynchronizationContext context)
1. Overload¶
public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<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
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | Source sequence. |
scheduler | [IScheduler](# | Scheduler to perform subscription and unsubscription actions on. |
Returns: IObservable
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
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or scheduler is null. |
2. Overload¶
public static IObservable<TSource> SubscribeOn<TSource>(this IObservable<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
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | Source sequence. |
context | SynchronizationContext | Synchronization context to perform subscription and unsubscription actions on. |
Returns: IObservable
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
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or context is null. |