Dispose Method
Collapse the table of content
Expand the table of content

CancellationTokenRegistration.Dispose Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Releases all resources used by the current instance of the CancellationTokenRegistration class.

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

public void Dispose()

Implements

IDisposable.Dispose()

ExceptionCondition
ObjectDisposedException

The token source that created this token registration instance has already been disposed.

Call Dispose when you are finished using the CancellationTokenRegistration. The Dispose method leaves the CancellationTokenRegistration in an unusable state. After calling Dispose, you must release all references to the CancellationTokenRegistration so the garbage collector can reclaim the memory that the CancellationTokenRegistration was occupying.

For more information, see [A17B0066-71C2-4BA4-9822-8E19332FC213] and [eb4e1af0-3b48-4fbc-ad4e-fc2f64138bf9].

NoteNote:

Always call Dispose before you release your last reference to the CancellationTokenRegistration. Otherwise, the resources it is using will not be freed until the garbage collector calls the CancellationTokenRegistration object's Finalize method.

Windows Phone OS

Supported in: 8.1, 8.0

Show:
© 2017 Microsoft