Learning cancellation of async tasks found this article:
As part of supporting the task-based async programming model in the .NET Framework 4.5, we added the
CancellationTokenstructure to the signatures of a large set of async APIs in the .NET Framework. For example, theHttpClientclass exposes aGetAsyncmethod overload that accepts a cancellation token. However, it is not essential for all async methods to support cancellation. For instance, if you look at theHttpContentclass, theLoadIntoBufferAsyncmethod does not expose an overload with a cancellation token.
What is fundamental difference between asynchronous operations that expose CancellationToken in their signatures and ones that don't?
What is fundamental difference between asynchronous operations that expose CancellationToken in their signatures and ones that don't?
Asynchronous operations that expose CancellationToken in their signatures:
Asynchronous operations that don't expose CancellationToken in their signatures:
yourAsyncObject.Dispose wraps up everything nicely)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With