PageAsyncTask.ExecuteInParallel Property

Definition

Gets a value that indicates whether the task can be processed in parallel with other tasks.

public bool ExecuteInParallel { get; }

Property Value

true if the task should be processed in parallel with other tasks; otherwise, false.

Examples

The following code example defines three asynchronous tasks that are each set to be processed in parallel. This example is part of a larger example found in the PageAsyncTask class overview.

PageAsyncTask asyncTask1 = new PageAsyncTask(slowTask1.OnBegin, slowTask1.OnEnd, slowTask1.OnTimeout, "Async1", true);
PageAsyncTask asyncTask2 = new PageAsyncTask(slowTask2.OnBegin, slowTask2.OnEnd, slowTask2.OnTimeout, "Async2", true);
PageAsyncTask asyncTask3 = new PageAsyncTask(slowTask3.OnBegin, slowTask3.OnEnd, slowTask3.OnTimeout, "Async3", true);

// Register the asynchronous task.
Page.RegisterAsyncTask(asyncTask1);
Page.RegisterAsyncTask(asyncTask2);
Page.RegisterAsyncTask(asyncTask3);

Remarks

The ExecuteInParallel property is set in the constructor. When multiple tasks are registered in a page and the ExecuteInParallel property is set to true, then those tasks are processed concurrently. However, if the ExecuteInParallel property is set to false, then those tasks are processed sequentially. For example, if a page contained two asynchronous tasks that each took 5 seconds to complete and ExecuteInParallel is set to true, both tasks will complete in 5 seconds. If ExecuteInParallel is set to false for these same two tasks, then the first task will complete in 5 seconds and the second task will complete 5 seconds after the completion of the first task.

Applies to

Produto Versões
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1