The Artima Developer Community
Sponsored Link

C# Answers Forum
Exit C# console application explicitely

3 replies on 1 page. Most recent reply: Oct 11, 2003 10:50 PM by dsa

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
Shrey

Posts: 2
Nickname: anoop
Registered: Apr, 2003

Exit C# console application explicitely Posted: Apr 8, 2003 2:22 AM
Reply to this message Reply
Advertisement
How can I Exit C# console application explicitely. Application.Exist() does not close application execution.
Thanks in advance


Shrey

Posts: 2
Nickname: anoop
Registered: Apr, 2003

Re: Exit C# console application explicitely Posted: Apr 8, 2003 4:28 AM
Reply to this message Reply
Following statement is working:-

Process.GetCurrentProcess().Kill();
Is this a correct way? o we have any other way to close the application explicitly?

Thank you

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Exit C# console application explicitely Posted: Apr 18, 2003 12:23 PM
Reply to this message Reply
I don't think that is a very safe approach, especially if you are doing any finalization, like saving files in your destructors or Dispose() methods. It is best if you can just return by normal means (that is, when you return from Main, the app is finished running). Exiting from various points in your app usually makes for more trouble than it is worth.

dsa

Posts: 1
Nickname: nicesai
Registered: Oct, 2003

Re: Exit C# console application explicitely Posted: Oct 11, 2003 10:50 PM
Reply to this message Reply
Did you try Environment.Exit() ? It is working for me.

Flat View: This topic has 3 replies on 1 page
Topic: DataGrid Control Previous Topic   Next Topic Topic: open a directory

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use