Task.Dispose Method
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Releases all resources used by the current instance of the Task class.
Namespace: System.Threading.Tasks
Assembly: mscorlib (in mscorlib.dll)
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
Call Dispose when you are finished using the Task. The Dispose method leaves the Task in an unusable state. After calling Dispose, you must release all references to the Task so the garbage collector can reclaim the memory that the Task was occupying.
For more information, see Cleaning Up Unmanaged Resources and Implementing a Dispose Method.
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.