Table of Contents

Struct CancellationTokenRegistration

Namespace
System.Threading
Assembly
System.Threading.dll

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

public struct CancellationTokenRegistration : IDisposable
Implements
Inherited Members

Remarks

To unregister a callback, dispose the corresponding Registration instance.

Methods

Dispose()

Disposes of the registration and unregisters the target callback from the associated CancellationToken. If the target callback is currently executing this method will wait until it completes, except in the degenerate cases where a callback method deregisters itself.

public void Dispose()

Equals(object)

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

public override bool Equals(object obj)

Parameters

obj object

The other object to which to compare this instance.

Returns

bool

True, if both this and obj are equal. False, otherwise. Two CancellationTokenRegistration instances are equal if they both refer to the output of a single call to the same Register method of a CancellationToken.

Equals(CancellationTokenRegistration)

Determines whether the current CancellationToken instance is equal to the specified object.

public bool Equals(CancellationTokenRegistration other)

Parameters

other CancellationTokenRegistration

The other CancellationTokenRegistration to which to compare this instance.

Returns

bool

True, if both this and other are equal. False, otherwise. Two CancellationTokenRegistration instances are equal if they both refer to the output of a single call to the same Register method of a CancellationToken.

GetHashCode()

Serves as a hash function for a CancellationTokenRegistration..

public override int GetHashCode()

Returns

int

A hash code for the current CancellationTokenRegistration instance.

Operators

operator ==(CancellationTokenRegistration, CancellationTokenRegistration)

Determines whether two CancellationTokenRegistration instances are equal.

public static bool operator ==(CancellationTokenRegistration left, CancellationTokenRegistration right)

Parameters

left CancellationTokenRegistration

The first instance.

right CancellationTokenRegistration

The second instance.

Returns

bool

True if the instances are equal; otherwise, false.

operator !=(CancellationTokenRegistration, CancellationTokenRegistration)

Determines whether two CancellationTokenRegistration instances are not equal.

public static bool operator !=(CancellationTokenRegistration left, CancellationTokenRegistration right)

Parameters

left CancellationTokenRegistration

The first instance.

right CancellationTokenRegistration

The second instance.

Returns

bool

True if the instances are not equal; otherwise, false.