C# Tutorial - How to use Cancellation Tokens. Manage Long-Running Tasks in your Code Efficiently!

preview_player
Показать описание
#dotnet #csharp #.NET #softwaredevelopment

Ongoing tasks in C# need at some point to be cancelled. Whether it's something that happens on a background task or on a thread, being able to gracefully exist a task is essential.

Cancellation tokens provide us with a point of reference which can be checked by tasks to decide whether they should stop running.

In this video I show you two examples that use cancellation tokens. The first one is an example of when Cancellation Tokens are overkill, using a WinForms app and a timer. The second example is a more relevant use case, demonstrating the use of cancellation tokens to gracefully halt an ongoing thread which was queued onto the thread pool.
Рекомендации по теме
Комментарии
Автор

Thank you for turning the music off. You won't believe how many morons let it play during the entire video.

charleswoodruff
Автор

For next videos, kindly use light theme or a bit bright theme and make the font big

obinnaokafor