title: Correct way to exit from a console application
body: <p>I've done some reading <a href="https://stackoverflow.com/questions/12180512/exit-from-a-console-application-in-c-sharp">here</a>, and <a href="https://stackoverflow.com/questions/692323/when-should-one-use-environment-exit-to-terminate-a-console-application">here</a> and I'm still confused about if I should use <code>Enviorment.Exit()</code> in my console application.</p>
  <p>In a method, I have the following code if the user types exit at the prompt,</p>
  <pre><code>if(userSelect == &quot;exit&quot;)
  {
      Environment.Exit(0);
  }
  </code></pre>
  <p>Update:</p>
  <pre><code>class Program
  {
      public static void Main(string[] args)
      {
          Console.WriteLine(&quot;Welcome to my Console App&quot;);
          Console.WriteLine();
          consoleManager();
      }
  
  
      public static void consoleManager()
      {
          string consolePrompt = &quot;ConsoleApp\&quot;&gt;&quot;;
  
          string whichMethod = &quot;&quot;;
          Console.Write(consolePrompt);
          whichMethod = Console.ReadLine();
  
          if(whichMethod == &quot;view enties&quot;)
          {
              viewEntry();
          }
          else
              if(whichMethod == &quot;Add Entry&quot;)
              {
                  addEntry();
              }
              else
                  if(whichMethod == &quot;exit&quot;)
                  {
                      //what to do here
                  }
                  else
                  {
                      help();
                  }
      }
  </code></pre>