How to make a C# console app terminate on the press of the "Esc" Button

Morad Tamer

Apr 21, 2016
hi Guys I was watching a video on YouTube from a channel called Barnacules Nerdgasm about how to make a Prank software the problem is that there is a piece of code the tells the app to close when ever a key then enter is pressed which is "Console.Read();" please correct me if I am wrong
so after I the keyboard manipulator writes about 250 characters the program terminates automatically before a set time to do other things
so how can I make it to respond to the "Esc" button to make it close only if this button was pressed

The video i was watching