Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>From MSDN:</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms157894.aspx" rel="noreferrer"><strong>Application.Exit</strong></a></p> <blockquote> <p>Informs all message pumps that they must terminate, and then closes all application windows after the messages have been processed. This is the code to use if you are have called Application.Run (WinForms applications), this method stops all running message loops on all threads and closes all windows of the application.</p> </blockquote> <p><a href="http://msdn.microsoft.com/en-us/library/system.environment.exit.aspx" rel="noreferrer"><strong>Environment.Exit</strong></a></p> <blockquote> <p>Terminates this process and gives the underlying operating system the specified exit code. This is the code to call when you are using console application.</p> </blockquote> <p>This article, <a href="http://geekswithblogs.net/mtreadwell/archive/2004/06/06/6123.aspx" rel="noreferrer">Application.Exit vs. Environment.Exit</a>, points towards a good tip:</p> <p>You can determine if <code>System.Windows.Forms.Application.Run</code> has been called by checking the <code>System.Windows.Forms.Application.MessageLoop</code> property. If true, then Run has been called and you can assume that a WinForms application is executing as follows.</p> <pre><code>if (System.Windows.Forms.Application.MessageLoop) { // WinForms app System.Windows.Forms.Application.Exit(); } else { // Console app System.Environment.Exit(1); } </code></pre> <p>Reference: <a href="https://stackoverflow.com/questions/554408/why-would-application-exit-fail-to-work">Why would Application.Exit fail to work?</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload