How to quit console when a user type a special word in console

Updated on November 4, 2017 in [A] C# .Net
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
1 on November 4, 2017

Hey guys,

 

First post here i’d to know how i can make the console shutdown  when a user for example type quit in the console 

  • Liked by
Reply
0 on November 4, 2017

Nvm found it by myself adding 

 

 

string userCommand = Console.ReadLine();

if (userCommand == “exit”)
{
Environment.Exit(0);

}

  • Liked by
Reply
Cancel