,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask})} ,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask},System.Boolean)} ,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask},System.Threading.Tasks.TaskScheduler)}
ObservableAsync.CreateAsBackgroundJob(Func, CancellationToken, ValueTask>) 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
Overloads¶
- 1.
public static IObservableAsync<T> CreateAsBackgroundJob<T>(Func<IObserverAsync<T>, CancellationToken, ValueTask> job) - 2.
public static IObservableAsync<T> CreateAsBackgroundJob<T>(Func<IObserverAsync<T>, CancellationToken, ValueTask> job, bool startSynchronously) - 3.
public static IObservableAsync<T> CreateAsBackgroundJob<T>(Func<IObserverAsync<T>, CancellationToken, ValueTask> job, TaskScheduler taskScheduler)
1. Overload¶
public static IObservableAsync<T> CreateAsBackgroundJob<T>(Func<IObserverAsync<T>, CancellationToken, ValueTask> job)
Summary: Creates a new observable sequence that runs the specified asynchronous job as a background task.
Type parameters
| Name | Description |
|---|---|
T | The type of elements produced by the observable sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
job | Func | A delegate that defines the asynchronous job to execute. The delegate receives an observer to report results and a cancellation token to observe cancellation requests. |
Returns: IObservableAsync
2. Overload¶
public static IObservableAsync<T> CreateAsBackgroundJob<T>(Func<IObserverAsync<T>, CancellationToken, ValueTask> job, bool startSynchronously)
Summary: Creates a new observable sequence that runs the specified asynchronous job as a background task.
Type parameters
| Name | Description |
|---|---|
T | The type of elements produced by the observable sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
job | Func | A delegate that defines the asynchronous job to execute. The delegate receives an observer to report results and a cancellation token to observe cancellation requests. |
startSynchronously | bool | true to start the job synchronously on the calling thread; otherwise, false to schedule it to run asynchronously. |
Returns: IObservableAsync
3. Overload¶
public static IObservableAsync<T> CreateAsBackgroundJob<T>(Func<IObserverAsync<T>, CancellationToken, ValueTask> job, TaskScheduler taskScheduler)
Summary: Creates a new observable sequence that runs the specified asynchronous job as a background task using the provided task scheduler.
Type parameters
| Name | Description |
|---|---|
T | The type of the elements produced by the observable sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
job | Func | A delegate that defines the asynchronous job to execute. The delegate receives an observer to report results and a cancellation token to observe cancellation requests. |
taskScheduler | TaskScheduler | The task scheduler that is used to schedule the background job. |
Returns: IObservableAsync