Application.Exit();, Environment.Exit(0); or this.Close();
-
I just wanted to know which one I should use. I have looked at the MSDN articles and have only found rigorous descriptions of each one but none of them give comparisons to the others. p.s. this is my first post, if I have done anything wrong please feel free to tell me. the code I have is:
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
GC.Collect();
Environment.Exit(0);//Or Application.Exit(); or this.Close(); I'm not sure
} -
I just wanted to know which one I should use. I have looked at the MSDN articles and have only found rigorous descriptions of each one but none of them give comparisons to the others. p.s. this is my first post, if I have done anything wrong please feel free to tell me. the code I have is:
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
GC.Collect();
Environment.Exit(0);//Or Application.Exit(); or this.Close(); I'm not sure
}Close() just closes the form, it doesn't necessarily cause exit. Here is comparison of Application.Exit and Environment.Exit: Application.Exit vs. Environment.Exit[^]
Giorgi Dalakishvili #region signature my articles #endregion
-
I just wanted to know which one I should use. I have looked at the MSDN articles and have only found rigorous descriptions of each one but none of them give comparisons to the others. p.s. this is my first post, if I have done anything wrong please feel free to tell me. the code I have is:
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
GC.Collect();
Environment.Exit(0);//Or Application.Exit(); or this.Close(); I'm not sure
}this.Close();
-
this.Close();