C# program shutdown with a specific key | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

C# program shutdown with a specific key

Hey! Can someone help me with that i would like to write a consol app int c#. I would like to make that this consol app closes only in one condition for example when i press esc or when i type exit. How can i code it?

20th Sep 2019, 7:43 AM
1310balint
1310balint - avatar
3 Answers
+ 1
do{ // some code; get input etc. if (input == "exit"){ break; } }while(true);
20th Sep 2019, 7:49 AM
Trigger
Trigger - avatar
0
This what you want?
20th Sep 2019, 7:49 AM
Trigger
Trigger - avatar
0
Yes i guess. I will try it. Thanks a lot
20th Sep 2019, 7:52 AM
1310balint
1310balint - avatar