© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
19 replies
Limited Past

How to use use ReadKey in a Task when i'm using ReadKey elsewhere to stop the program from exiting?

I start a Task and then use Console.ReadKey to stop the program from exiting. I want to use ReadKey again in the Task but the first key it reads is from the first Console.ReadKey that I use to stop the program from exiting....Does anyone know a solution to this?
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

✅ how to stop the task in this case?
C#CC# / help
3y ago
❔ I'm getting an error in a program I'm supposed to use.
C#CC# / help
3y ago
✅ How to install a callback for an awaited item when using Task.WhenAll
C#CC# / help
3y ago
Console.ReadKey() binds to Consolekeyinfo
C#CC# / help
4y ago