Class AsyncTask

Class AsyncTask

Namespace: Aspose.Imaging.AsyncTask
Assembly: Aspose.Imaging.dll (25.7.0)

The static factory class for creating the asynchronous tasks

public static async Task StartAsync()
   {
       var task1 = DoTask1();
       var task2 = DoTask2();
       await Task.WhenAll(task1, task2);
   }
   private static Task DoTask1()
   {
       return Task.Run(() =>
       {
       });
   }
   private static Task DoTask2()
   {
       return Task.Run(() =>
       {
       });
   }

Inheritance

object AsyncTask

Inherited Members

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Methods

Create(AsyncTaskAction)

Creates the asynchronous task without any result.

public static async Task<IAsyncTask> Create(AsyncTaskAction taskAction)
    {
    }

Parameters

taskAction AsyncTaskAction

The task action.

Returns

IAsyncTask

The asynchronous task

Create(AsyncTaskFunc)

Creates the asynchronous task with generic type result.

public static async Task<IAsyncTask> Create(AsyncTaskFunc taskFunc)
    {
    }
- Proper indentation
- Added an 'async' keyword before 'Task'
- Added a space between '<' and 'IAsyncTask' in return type for better readability
- Added a space after the method name, before the open brace '{'.

Parameters

taskFunc AsyncTaskFunc

The task function.

Returns

IAsyncTask

The asynchronous task

 English