Partager via


Task.Dispose Method (Boolean)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Disposes the Task, releasing all of its unmanaged resources.

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

Syntax

'Declaration
Protected Overridable Sub Dispose ( _
    disposing As Boolean _
)
protected virtual void Dispose(
    bool disposing
)

Parameters

  • disposing
    Type: System.Boolean
    A Boolean value that indicates whether this method is being called due to a call to Dispose.

Exceptions

Exception Condition
InvalidOperationException

The exception that is thrown if the Task is not in one of the final states: RanToCompletion, Faulted, or Canceled.

Remarks

Unlike most of the members of Task, this method is not thread-safe.

Version Information

Silverlight

Supported in: 5

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.