Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is an article which expands on the same train of thought you are going through: <a href="http://www.dev102.com/2008/06/24/how-do-you-exit-your-net-application/" rel="noreferrer">http://www.dev102.com/2008/06/24/how-do-you-exit-your-net-application/</a></p> <p>Basically: </p> <blockquote> <ul> <li><p>Environment.Exit - From MSDN: 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></li> <li><p>Application.Exit - From MSDN: 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. There are some more issues about this method, read about it in the MSDN page.</p></li> </ul> </blockquote> <p>Another discussion of this: <a href="http://geekswithblogs.net/mtreadwell/archive/2004/06/06/6123.aspx" rel="noreferrer">http://geekswithblogs.net/mtreadwell/archive/2004/06/06/6123.aspx</a></p> <p>This article points out a good tip:</p> <p>You can determine if System.Windows.Forms.Application.Run has been called by checking the System.Windows.Forms.Application.MessageLoop 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) { // Use this since we are a WinForms app System.Windows.Forms.Application.Exit(); } else { // Use this since we are a console app System.Environment.Exit(1); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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