Cancellation gets a bit tricky because we end up passing around a cancellation token. But there's a problem: if we create a cancellation token directly, we can't change it. Fortunately, there's a easy solution: use a cancellation token source to manage the token.
Part 4 of my video series on Task and Await is now available. This time we look at the basics of cancelling an asynchronous process. To get code, articles, and other videos, check here: Exploring Task, Await, and Asynchronous Programming.
Watch the video on YouTube: Task and Await in C# - Part 4: Basic Cancellation
Or read the article: Task and Await - Basic Cancellation
Or watch it here:
If you've missed the previous episodes, get them all together in the playlist:
If you've got suggestions for other topics, please leave a comment. I'm always looking for good stuff to talk about.