Hi,
In my console application using C#, I have a infinite loop to process a task. I want to use some methods to catch a specific key pressed (ex: Alt+B) to break from the loop, and do some cleanp-up work before exit the program.
I know Ctrl+C can exit, but it exit to the program immediately without do the clean up. It even doesn't call the finally clause if I hit the Ctrl+C key.
Is there any way to the Key pressed?
Thanks,
Start Free Trial