CancellationToken.CanBeCanceled CancellationToken.CanBeCanceled CancellationToken.CanBeCanceled CancellationToken.CanBeCanceled Property

Definición

Obtiene si este token es capaz de existir en el estado cancelado.Gets whether this token is capable of being in the canceled state.

public:
 property bool CanBeCanceled { bool get(); };
public bool CanBeCanceled { get; }
member this.CanBeCanceled : bool
Public ReadOnly Property CanBeCanceled As Boolean

Valor de propiedad

true si este token puede estar en estado cancelado; en caso contrario, false.true if this token is capable of being in the canceled state; otherwise, false.

Comentarios

Si CanBeCanceled IsCancellationRequested truedevuelve false, se garantiza que el token nunca pasará a un estado cancelado, lo que significa que nunca devolverá.If CanBeCanceled returns false, it is guaranteed that the token will never transition into a canceled state, meaning that IsCancellationRequested will never return true. La propiedad estática CancellationToken.None devuelve un token de cancelación que no se puede cancelar.A cancellation token that cannot be canceled is returned by the static CancellationToken.None property.

Opcionalmente, puede usar esta propiedad para determinar si se puede cancelar un token de cancelación antes de examinar el valor de la IsCancellationRequested propiedad para determinar si se ha cancelado.You can optionally use this property to determine whether a cancellation token can be canceled before examining the value of the IsCancellationRequested property to determine whether it has been canceled.

Se aplica a

Consulte también: