Await keyboard event in a Console application

Viewed 1991

Is there a way to get a Task that completes and returns a key press without a dedicated thread?

// Kernel callback, not a new thread in my process waiting for a keyboard event
var key = await KeyPress();

As Console.ReadKey() is a blocking call and uses a thread only to wait for user input.

2 Answers
Related