I assumed that Application.Exit causes app to exit imemdiately but I can see that according to example below, it will exit after the for cycle ends. Also when this command will force the app to exit?
for (int I = 0; I < 1000; I++)
{
if (I == 1)
Application.Exit();
}
Application.Exit() will cause the application to exit once it returns to the underlying message pump. If you’re running code in the UI thread, this won’t be until you return from whatever UI method you’re in (such as a button click handler.)