kat2068
kat2068
CC#
Created by kat2068 on 3/11/2023 in #help
✅ Event-like event for ReadKey
with Console.ReadKey, the entire program waits for an input before continuing. is there a way to have an event similar to .ReadKey instead? For example, after 5 seconds of no input from ReadKey, I would like to have some random .WriteLine text, BUT if i put the ReadKey in an async method, after the .WriteLine is done, the program exits without ever getting the ReadKey im considering to restructure my program, so that anything i want to happen ends up in a queue, then the entire program in a do while loop (exiting the loop exits the program). then if theres just waiting for the input, the program will just loop over nothing repeatedly, still waiting for the ReadKey from the async Task
24 replies