Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

struct System.​Threading.​CancellationTokenRegistration

Assembly: System.Runtime

Represents a callback delegate that has been registered with a <see cref="T:System.Threading.CancellationToken" /> .

Properties

Token
Gets the <see cref="T:System.Threading.CancellationToken" /> with which this registration is associated.

Methods

public void
Dispose​()
Disposes of the registration and unregisters the target callback from the associated <see cref="T:System.Threading.CancellationToken" /> .
public ValueTask
DisposeAsync​()
Returns A task that represents the asynchronous dispose operation.
Disposes of the registration and unregisters the target callback from the associated <see cref="T:System.Threading.CancellationToken" /> .
public bool
Equals​(object obj)
obj The other object to which to compare this instance.
Returns <see langword="true" /> if both this and <paramref name="obj" /> are equal. False, otherwise. Two <see cref="T:System.Threading.CancellationTokenRegistration" /> instances are equal if they both refer to the output of a single call to the same Register method of a <see cref="T:System.Threading.CancellationToken" /> .
Determines whether the current <see cref="T:System.Threading.CancellationTokenRegistration" /> instance is equal to the specified <see cref="T:System.Threading.CancellationTokenRegistration" /> .
public bool
Equals​(CancellationTokenRegistration other)
other The other <see cref="T:System.Threading.CancellationTokenRegistration" /> to which to compare this instance.
Returns <see langword="true" /> if both this and <paramref name="other" /> are equal. False, otherwise. Two <see cref="T:System.Threading.CancellationTokenRegistration" /> instances are equal if they both refer to the output of a single call to the same Register method of a <see cref="T:System.Threading.CancellationToken" /> .
Determines whether the current <see cref="T:System.Threading.CancellationTokenRegistration" /> instance is equal to the specified <see cref="T:System.Threading.CancellationTokenRegistration" /> .
public int
GetHashCode​()
Returns A hash code for the current <see cref="T:System.Threading.CancellationTokenRegistration" /> instance.
Serves as a hash function for a <see cref="T:System.Threading.CancellationTokenRegistration" /> .
public bool
Unregister​()
Returns <see langword="true" /> if the method succeeds; otherwise, <see langword="false" /> .
Disposes of the registration and unregisters the target callback from the associated <see cref="T:System.Threading.CancellationToken" /> .
public string
ToString​()
Inherited from ValueType
Returns The fully qualified type name.
Returns the fully qualified type name of this instance.
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .