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

Поделиться
HTML-код
  • Опубликовано: 28 авг 2024
  • #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.

Комментарии • 6

  • @charlesmarchand9098
    @charlesmarchand9098 6 месяцев назад

    well explained thank you!

  • @charleswoodruff9013
    @charleswoodruff9013 Год назад +2

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

  • @obinnaokafor6252
    @obinnaokafor6252 Год назад +1

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

  • @alefalessandropereiradasil9320
    @alefalessandropereiradasil9320 Год назад +1

    I came because of codewrinkles

    • @nickproudprogrammer
      @nickproudprogrammer  Год назад

      Thanks for letting me know! Prompted me to check out his video and offer thanks 👍