CancellationTokenRegistration Struct  
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a callback delegate that has been registered with a CancellationToken.
public value class CancellationTokenRegistration : IDisposable, IEquatable<System::Threading::CancellationTokenRegistration>public value class CancellationTokenRegistration : IAsyncDisposable, IDisposable, IEquatable<System::Threading::CancellationTokenRegistration>public struct CancellationTokenRegistration : IDisposable, IEquatable<System.Threading.CancellationTokenRegistration>public readonly struct CancellationTokenRegistration : IAsyncDisposable, IDisposable, IEquatable<System.Threading.CancellationTokenRegistration>public readonly struct CancellationTokenRegistration : IDisposable, IEquatable<System.Threading.CancellationTokenRegistration>type CancellationTokenRegistration = struct
    interface IDisposabletype CancellationTokenRegistration = struct
    interface IAsyncDisposable
    interface IDisposablePublic Structure CancellationTokenRegistration
Implements IDisposable, IEquatable(Of CancellationTokenRegistration)Public Structure CancellationTokenRegistration
Implements IAsyncDisposable, IDisposable, IEquatable(Of CancellationTokenRegistration)- Inheritance
- Implements
Remarks
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.
Properties
| Token | Gets the CancellationToken with which this registration is associated. | 
Methods
| Dispose() | Disposes of the registration and unregisters the target callback from the associated CancellationToken. | 
| DisposeAsync() | Disposes of the registration and unregisters the target callback from the associated CancellationToken. | 
| Equals(CancellationTokenRegistration) | Determines whether the current CancellationTokenRegistration instance is equal to the specified CancellationTokenRegistration. | 
| Equals(Object) | Determines whether the current CancellationTokenRegistration instance is equal to the specified CancellationTokenRegistration. | 
| GetHashCode() | Serves as a hash function for a CancellationTokenRegistration. | 
| Unregister() | Disposes of the registration and unregisters the target callback from the associated CancellationToken. | 
Operators
| Equality(CancellationTokenRegistration, CancellationTokenRegistration) | Determines whether two CancellationTokenRegistration instances are equal. | 
| Inequality(CancellationTokenRegistration, CancellationTokenRegistration) | Determines whether two CancellationTokenRegistration instances are not equal. | 
Extension Methods
| ConfigureAwait(IAsyncDisposable, Boolean) | Configures how awaits on the tasks returned from an async disposable will be performed. | 
Applies to
Thread Safety
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.