I read here and here , and I'm still confused if I should use Enviorment.Exit()in my console application.
In the method, I have the following code, if the user enters exit at the prompt,
if(userSelect == "exit"){
{
Environment.Exit(0);
}
Update:
class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Welcome to my Console App");
Console.WriteLine();
consoleManager();
}
public static void consoleManager()
{
string consolePrompt="ConsoleApp">";
string whichMethod="";
Console.Write(consolePrompt);
whichMethod = Console.ReadLine();
if(whichMethod == "view enties")
{
viewEntry();
}
else
if(whichMethod == "Add Entry")
{
addEntry();
}
else
if(whichMethod == "exit"){
{
//what to do here
}
}
else{
help();
}
}
user5910494
source
share