[Mono-devel-list] Exiting a console application

Martin Baulig martin at ximian.com
Fri Feb 20 19:54:12 EST 2004


On Sat, 2004-02-21 at 00:55, Namit Dhameja wrote:
> Hi,
>    I have a console application running on SUSE 9.0. When I want to
> exit the application than I call
> "System.Diagnostics.Process.GetCurrentProcess().Kill ();". This runs
> fine on Windows(MS.NET), that is to say that the application exits.
> But on Linux it doesn't work, i think its not implemented yet. Could
> someone  suggest a workaround for this.

Hi,

that's probably the most funny (and broken) way I've ever seen someone
to do that ;-)

The correct way of doing it is using System.Environment.Exit() - it
takes one argument which is the exit code.  If you're exiting normally,
you should use 0.

--
Martin Baulig <martin at ximian.com>
Now blogging !  http://primates.ximian.com/~martin/blog




More information about the Mono-devel-list mailing list