Disposes the Task, releasing all of its unmanaged resources.
Namespace:
System.Threading.Tasks
Assembly:
System.Threading (in System.Threading.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Sub Dispose |
C# |
---|
public void Dispose() |
Implements
IDisposable..::.Dispose()()()Remarks
Unlike most of the members of Task, this method is not thread-safe.
Also, Dispose()()() may only be called on a Task that is in one of
the final states: RanToCompletion,
Faulted, or
Canceled.
Exceptions
Exception | Condition |
---|---|
System..::.InvalidOperationException | The exception that is thrown if the Task is not in one of the final states: RanToCompletion, Faulted, or Canceled. |