CancellationTokenRegistration Struct
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 IDisposable
type CancellationTokenRegistration = struct
interface IAsyncDisposable
interface IDisposable
Public Structure CancellationTokenRegistration
Implements IDisposable, IEquatable(Of CancellationTokenRegistration)
Public Structure CancellationTokenRegistration
Implements IAsyncDisposable, IDisposable, IEquatable(Of CancellationTokenRegistration)
- Inheritance
- Implements
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.
Token |
Gets the CancellationToken with which this registration is associated. |
Dispose() |
Disposes of the registration and unregisters the target callback from the associated CancellationToken. |
Dispose |
Disposes of the registration and unregisters the target callback from the associated CancellationToken. |
Equals(Cancellation |
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. |
Get |
Serves as a hash function for a CancellationTokenRegistration. |
Unregister() |
Disposes of the registration and unregisters the target callback from the associated CancellationToken. |
Equality(Cancellation |
Determines whether two CancellationTokenRegistration instances are equal. |
Inequality(Cancellation |
Determines whether two CancellationTokenRegistration instances are not equal. |
Configure |
Configures how awaits on the tasks returned from an async disposable will be performed. |
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1 |
UWP | 10.0 |
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.
.NET feedback
.NET is an open source project. Select a link to provide feedback: