No video

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

  Рет қаралды 3,268

Nick Proud

Nick Proud

Күн бұрын

#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 Жыл бұрын
Thank you for turning the music off. You won't believe how many morons let it play during the entire video.
@obinnaokafor6252
@obinnaokafor6252 11 ай бұрын
For next videos, kindly use light theme or a bit bright theme and make the font big
@alefalessandropereiradasil9320
@alefalessandropereiradasil9320 Жыл бұрын
I came because of codewrinkles
@nickproudprogrammer
@nickproudprogrammer Жыл бұрын
Thanks for letting me know! Prompted me to check out his video and offer thanks 👍
JSON support gets a major missing feature in .NET 7
9:53
Nick Chapsas
Рет қаралды 50 М.
天使救了路飞!#天使#小丑#路飞#家庭
00:35
家庭搞笑日记
Рет қаралды 91 МЛН
Lehanga 🤣 #comedy #funny
00:31
Micky Makeover
Рет қаралды 31 МЛН
Kids' Guide to Fire Safety: Essential Lessons #shorts
00:34
Fabiosa Animated
Рет қаралды 16 МЛН
¿Qué diablos es Task en C# .Net? Programación asíncrona
14:40
8 await async mistakes that you SHOULD avoid in .NET
21:13
Nick Chapsas
Рет қаралды 311 М.
Cancellation Token in .NET | Exploring C# and DOTNET
18:42
Rahul Nath
Рет қаралды 5 М.
Brutally honest advice for new .NET Web Developers
7:19
Ed Andersen
Рет қаралды 151 М.
Thread → Task. Многопоточность и Асинхронность
13:39
Архитектор ПО. Александр Желнин
Рет қаралды 29 М.
Don't Use Polly in .NET Directly. Use this instead!
14:58
Nick Chapsas
Рет қаралды 57 М.
Avoiding long running HTTP API requests.
7:24
CodeOpinion
Рет қаралды 15 М.