CancellationTokenSource.CancelAsync Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Communicates a request for cancellation asynchronously.
public:
System::Threading::Tasks::Task ^ CancelAsync();
public System.Threading.Tasks.Task CancelAsync ();
member this.CancelAsync : unit -> System.Threading.Tasks.Task
Public Function CancelAsync () As Task
A task that will complete after cancelable operations and callbacks registered with the associated CancellationToken have completed.
This CancellationTokenSource has been disposed.
The associated CancellationToken will be notified of the cancellation and will synchronously transition to a state where IsCancellationRequested returns true
. Any callbacks or cancelable operations registered with the CancellationToken will be executed asynchronously, with the returned Task representing their eventual completion.
Callbacks registered with the token should not throw exceptions. However, any such exceptions that are thrown will be aggregated into an AggregateException, such that one callback throwing an exception will not prevent other registered callbacks from being executed.
The ExecutionContext that was captured when each callback was registered will be reestablished when the callback is invoked.
Proizvod | Verzije |
---|---|
.NET | 8, 9 |
Povratne informacije o proizvodu .NET
.NET je projekt otvorenog koda. Odaberite vezu za slanje povratnih informacija: