Waiting for a keypress asynchronously in a C# console app
This one’s kind of specific, but sometimes when you’re writing a console app that does a lot of asynchronous stuff, and you want to cancel it at any time by pressing escape. via GIPHY However, Console.ReadKey is blocking… so that’s not super great. CancellationToken First, make use of the cancellation tokens. I’ve talked about them … [Read more…]