CancellationTokenRegistration Structure


Represents a callback delegate that has been registered with a CancellationToken.

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

<HostProtectionAttribute(SecurityAction.LinkDemand, Synchronization := True,
	ExternalThreading := True)>
Public Structure CancellationTokenRegistration
	Implements IEquatable(Of CancellationTokenRegistration), IDisposable


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


Determines whether the current CancellationTokenRegistration instance is equal to the specified CancellationTokenRegistration.


Determines whether the current CancellationTokenRegistration instance is equal to the specified CancellationTokenRegistration.(Overrides ValueType.Equals(Object).)


Serves as a hash function for a CancellationTokenRegistration.(Overrides ValueType.GetHashCode().)


Gets the Type of the current instance.(Inherited from Object.)


Returns the fully qualified type name of this instance.(Inherited from ValueType.)

System_CAPS_puboperatorSystem_CAPS_staticEquality(CancellationTokenRegistration, CancellationTokenRegistration)

Determines whether two CancellationTokenRegistration instances are equal.

System_CAPS_puboperatorSystem_CAPS_staticInequality(CancellationTokenRegistration, CancellationTokenRegistration)

Determines whether two CancellationTokenRegistration instances are not equal.

The callback is called when the token is canceled. To unregister a callback, dispose the corresponding Registration instance. For more information and code examples see Cancellation in Managed Threads.

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

All public and protected members of CancellationTokenRegistration are thread-safe and may be used concurrently from multiple threads, with the exception of Dispose, which must only be used when all other operations on the CancellationTokenRegistration have completed.

Return to top