Is there any events for the console like in WF?

0

I made a code to close the Console when F9 was tight, and I remembered that in Windows Forms there are events, which makes things like this much easier, I gave a search to see how to create events in the Console and only found some MSDN articles, which in my view, are pretty bad and explain almost nothing. Anyway, how to create events in the Console? I do not want information only from my code, I also want to understand how it works.

My code:

while(true)
if (GetKeyState(0x78) != 0 && GetKeyState(0x78) != 1)
{
    if (BeepEnable)
        Console.Beep(4000, 100);
    Environment.Exit(0);
}
    
asked by anonymous 08.06.2017 / 02:14

0 answers