Class EvergineForegroundTask
Provides methods for creating tasks that will be queued in the main Evergine thread.
Namespace: Evergine.Framework.Threading
Assembly: Evergine.Framework.dll
Syntax
public static class EvergineForegroundTaskRemarks
The tasks will be queued using the ForegroundTaskScheduler.
Methods
Run(Action)
Creates a task that runs the specified action in the main Evergine thread.
Declaration
public static Task Run(Action action)Parameters
| Type | Name | Description | 
|---|---|---|
| Action | action | The action to execute asynchronously. | 
Returns
| Type | Description | 
|---|---|
| Task | A task that represents the completion of the action. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | The  | 
Run(Action, CancellationToken)
Creates a task that runs the specified action in the main Evergine thread.
Declaration
public static Task Run(Action action, CancellationToken cancellationToken)Parameters
| Type | Name | Description | 
|---|---|---|
| Action | action | The action to execute. | 
| CancellationToken | cancellationToken | The CancellationToken to use to request cancellation of this task. | 
Returns
| Type | Description | 
|---|---|
| Task | A task that represents the completion of the action. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | The  | 
Run(Func<Task>)
Creates a task that runs the specified function in the main Evergine thread.
Declaration
public static Task Run(Func<Task> function)Parameters
| Type | Name | Description | 
|---|---|---|
| Func<Task> | function | The function to execute asynchronously. | 
Returns
| Type | Description | 
|---|---|
| Task | A task that represents the completion of the action. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | The  | 
Run(Func<Task>, CancellationToken)
Creates a task that runs the specified function in the main Evergine thread.
Declaration
public static Task Run(Func<Task> function, CancellationToken cancellationToken)Parameters
| Type | Name | Description | 
|---|---|---|
| Func<Task> | function | The function to execute. | 
| CancellationToken | cancellationToken | The CancellationToken to use to request cancellation of this task. | 
Returns
| Type | Description | 
|---|---|
| Task | A task that represents the completion of the function. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | The  | 
Run<TResult>(Func<Task<TResult>>)
Creates a task that runs the specified function in the main Evergine thread.
Declaration
public static Task<TResult> Run<TResult>(Func<Task<TResult>> function)Parameters
| Type | Name | Description | 
|---|---|---|
| Func<Task<TResult>> | function | The function to execute asynchronously. | 
Returns
| Type | Description | 
|---|---|
| Task<TResult> | A task that represents the completion of the action. | 
Type Parameters
| Name | Description | 
|---|---|
| TResult | The task result type. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | The  | 
Run<TResult>(Func<Task<TResult>>, CancellationToken)
Creates a task that runs the specified function in the main Evergine thread.
Declaration
public static Task<TResult> Run<TResult>(Func<Task<TResult>> function, CancellationToken cancellationToken)Parameters
| Type | Name | Description | 
|---|---|---|
| Func<Task<TResult>> | function | The function to execute. | 
| CancellationToken | cancellationToken | The CancellationToken to use to cancel the task. | 
Returns
| Type | Description | 
|---|---|
| Task<TResult> | A task that represents the completion of the action. | 
Type Parameters
| Name | Description | 
|---|---|
| TResult | The task result type. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | The  | 
Run<TResult>(Func<TResult>)
Creates a task that runs the specified function in the main Evergine thread.
Declaration
public static Task<TResult> Run<TResult>(Func<TResult> function)Parameters
| Type | Name | Description | 
|---|---|---|
| Func<TResult> | function | The function to execute asynchronously. | 
Returns
| Type | Description | 
|---|---|
| Task<TResult> | A task that represents the completion of the action. | 
Type Parameters
| Name | Description | 
|---|---|
| TResult | The task result type. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | The  | 
Run<TResult>(Func<TResult>, CancellationToken)
Creates a task that runs the specified function in the main Evergine thread.
Declaration
public static Task<TResult> Run<TResult>(Func<TResult> function, CancellationToken cancellationToken)Parameters
| Type | Name | Description | 
|---|---|---|
| Func<TResult> | function | The function to execute. | 
| CancellationToken | cancellationToken | The CancellationToken to use to cancel the task. | 
Returns
| Type | Description | 
|---|---|
| Task<TResult> | A task that represents the completion of the action. | 
Type Parameters
| Name | Description | 
|---|---|
| TResult | The task result type. | 
Exceptions
| Type | Condition | 
|---|---|
| ArgumentNullException | The  |