Created
January 11, 2021 14:02
-
-
Save fafa3711/bf0e94ced5c2274935bc8eb303e53f57 to your computer and use it in GitHub Desktop.
Keep Console from closing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var exit = new ManualResetEvent(false)) | |
{ | |
Console.CancelKeyPress += (sender, args) => { args.Cancel = true; exit.Set(); }; | |
exit.WaitOne(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment