© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
23 replies
Kat

✅ 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
ReadKey
instead?

For example, after 5 seconds of no input from
ReadKey
ReadKey
, I would like to have some random .
WriteLine
WriteLine
text, BUT if i put the
ReadKey
ReadKey
in an async method, after the .WriteLine is done, the program exits without ever getting the
ReadKey
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
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Console.ReadKey() blocking
C#CC# / help
4y ago
ReadKey() input question [Answered]
C#CC# / help
4y ago
Console.ReadKey() binds to Consolekeyinfo
C#CC# / help
4y ago
❔ Console.ReadKey not working with key modifiers
C#CC# / help
3y ago