Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the C# equivalence for the JAVA `System.exit(0);`? [duplicate]

Tags:

java

c#

What is the C# equivalence for System.exit(0); ?

Thanks

like image 580
JAN Avatar asked Dec 06 '13 09:12

JAN


People also ask

What is C language in simple words?

What Does C Programming Language (C) Mean? C is a high-level and general-purpose programming language that is ideal for developing firmware or portable applications. Originally intended for writing system software, C was developed at Bell Labs by Dennis Ritchie for the Unix Operating System in the early 1970s.

What is C is used for?

C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...


Video Answer


2 Answers

If you are using a Console Application -

Environment.Exit(exitCode); 

Else if you are using a Windows Forms based application -

Application.Exit(); 

Courtesy: http://www.dreamincode.net/forums/topic/273503-java-systemexit0%3B-equivalent-in-c%23/

like image 124
Kamlesh Arya Avatar answered Sep 20 '22 01:09

Kamlesh Arya


You can use Environment.Exit(0) instead. Note that this is somewhat more complicated than Java due to some permissions issues, but in general this is the symmetrical equivalent.

You can read more about the possible Exceptions thrown in the linked documentation.

like image 36
asteri Avatar answered Sep 19 '22 01:09

asteri