Skip to content

,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)

View source

Summary: Creates a new observable sequence that runs the specified asynchronous job as a background task.

Type parameters

NameDescription
TThe type of elements produced by the observable sequence.

Parameters

NameTypeDescription
jobFunc, CancellationToken, ValueTask>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 -- An ObservableAsync that represents the observable sequence produced by the background job.

2. Overload

public static IObservableAsync<T> CreateAsBackgroundJob<T>(Func<IObserverAsync<T>, CancellationToken, ValueTask> job, bool startSynchronously)

View source

Summary: Creates a new observable sequence that runs the specified asynchronous job as a background task.

Type parameters

NameDescription
TThe type of elements produced by the observable sequence.

Parameters

NameTypeDescription
jobFunc, CancellationToken, ValueTask>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.
startSynchronouslybooltrue to start the job synchronously on the calling thread; otherwise, false to schedule it to run asynchronously.

Returns: IObservableAsync -- An ObservableAsync that represents the observable sequence produced by the background job.

3. Overload

public static IObservableAsync<T> CreateAsBackgroundJob<T>(Func<IObserverAsync<T>, CancellationToken, ValueTask> job, TaskScheduler taskScheduler)

View source

Summary: Creates a new observable sequence that runs the specified asynchronous job as a background task using the provided task scheduler.

Type parameters

NameDescription
TThe type of the elements produced by the observable sequence.

Parameters

NameTypeDescription
jobFunc, CancellationToken, ValueTask>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.
taskSchedulerTaskSchedulerThe task scheduler that is used to schedule the background job.

Returns: IObservableAsync -- An ObservableAsync that represents the asynchronous background job and emits the results produced by the job.