This article gave me clearness
Application.Exit vs. Environment.Exit
Msdn Help
Application.Exit
Environment.Exit
Essence of the blog post!
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);
}
Good example - Code determines in which context used, Console, Winforms, Class Library, and calls right method
1 comment:
realy Good Example
Post a Comment