ApplicationContext.ExitThread Method ()
Terminates the message loop of the thread.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The following code example is an excerpt from the example in the ApplicationContext class overview. This example keeps track of open forms and exits the current thread when all forms are closed. The OnFormClosed method is an event handler for the Closed event. When the number of open forms is equal to 0, then current thread is exited by calling the method. The number of forms is tracked by incrementing the formCount variable when a form is shown, and decrementing it when a form is closed.
Some code is not shown for the purpose of brevity. See ApplicationContext for the whole code listing.
Available since 1.1