Fun C# Code #1 - Infinite Delay (until cancelled)

I came across this code when reading 'Concurrency in C# Cookbook' by Stephen Cleary. Did you know you can have an infinite Task.Delay without loops?

Obviously, there isn't much point in spinning a task that litterally will do nothing. You can use a CancellationToken to cancel the task.

No point. It's just one of the things that makes one of the mes chuckle. - Sheldon Cooper

Leave a comment