CancellationToken.UnsafeRegister Metodo

Definizione

Overload

Nome Descrizione
UnsafeRegister(Action<Object,CancellationToken>, Object)

Registra un delegato che verrà chiamato quando cancellationToken viene annullato.

UnsafeRegister(Action<Object>, Object)

Registra un delegato chiamato quando viene CancellationToken annullato.

UnsafeRegister(Action<Object,CancellationToken>, Object)

Origine:
CancellationToken.cs
Origine:
CancellationToken.cs
Origine:
CancellationToken.cs
Origine:
CancellationToken.cs
Origine:
CancellationToken.cs

Registra un delegato che verrà chiamato quando cancellationToken viene annullato.

public:
 System::Threading::CancellationTokenRegistration UnsafeRegister(Action<System::Object ^, System::Threading::CancellationToken> ^ callback, System::Object ^ state);
public System.Threading.CancellationTokenRegistration UnsafeRegister(Action<object?,System.Threading.CancellationToken> callback, object? state);
member this.UnsafeRegister : Action<obj, System.Threading.CancellationToken> * obj -> System.Threading.CancellationTokenRegistration
Public Function UnsafeRegister (callback As Action(Of Object, CancellationToken), state As Object) As CancellationTokenRegistration

Parametri

callback
Action<Object,CancellationToken>

Delegato da eseguire quando CancellationToken viene annullato.

state
Object

Stato da passare all'oggetto callback quando viene richiamato il delegato. Può trattarsi di null.

Valori restituiti

CancellationTokenRegistration Istanza che può essere utilizzata per annullare la registrazione del callback.

Eccezioni

callback è null.

Commenti

Se questo token è già nello stato annullato, il delegato verrà eseguito immediatamente e in modo sincrono. Qualsiasi eccezione generata dal delegato viene propagata fuori da questa chiamata al metodo. ExecutionContext non viene acquisito o propagato alla chiamata del callback.

Si applica a

UnsafeRegister(Action<Object>, Object)

Origine:
CancellationToken.cs
Origine:
CancellationToken.cs
Origine:
CancellationToken.cs
Origine:
CancellationToken.cs
Origine:
CancellationToken.cs

Registra un delegato chiamato quando viene CancellationToken annullato.

public:
 System::Threading::CancellationTokenRegistration UnsafeRegister(Action<System::Object ^> ^ callback, System::Object ^ state);
public System.Threading.CancellationTokenRegistration UnsafeRegister(Action<object?> callback, object? state);
member this.UnsafeRegister : Action<obj> * obj -> System.Threading.CancellationTokenRegistration
Public Function UnsafeRegister (callback As Action(Of Object), state As Object) As CancellationTokenRegistration

Parametri

callback
Action<Object>

Delegato da eseguire quando l'oggetto CancellationToken viene annullato.

state
Object

Stato da passare all'oggetto callback quando viene richiamato il delegato. Può trattarsi di null.

Valori restituiti

Oggetto che può essere utilizzato per annullare la registrazione del callback.

Eccezioni

callback è null.

Commenti

Se questo token è già nello stato annullato, il delegato viene eseguito immediatamente e in modo sincrono. Qualsiasi eccezione generata dal delegato viene propagata fuori da questa chiamata al metodo.

L'oggetto ExecutionContext non viene acquisito o propagato alla chiamata del callback.

Si applica a