Task.Status Property

 

Gets the TaskStatus of this task.

Namespace:   System.Threading.Tasks
Assembly:  mscorlib (in mscorlib.dll)

member Status : TaskStatus with get

Property Value

Type: System.Threading.Tasks.TaskStatus

The current TaskStatus of this task instance.

Retrieving the value of the Task.Status property does not block the calling thread until the task has completed.

For more information and an example, see Chaining Tasks by Using Continuation Tasks and How to: Cancel a Task and Its Children.

The following example creates 20 tasks that will loop until a counter is incremented to a value of 2 million. When the first 10 tasks reach 2 million, the cancellation token is cancelled, and any tasks whose counters have not reached 2 million are cancelled. The example then examines the Status property of each task to indicate whether it completed successfully or was cancelled. For those that completed, it displays the value returned by the task.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 5.0
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
Return to top
Show: