Uredi

Deli z drugimi prek


CancellationTokenRegistration Struct

Definition

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
CancellationTokenRegistration
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.

See also