
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
What is the C# equivalent for the Java System.exit(0)?
The C# equivalent for Java System.exit(0) is −
Environment.Exit(exitCode);
The Environment.Exit() method terminates this process and returns an exit code to the operating system.
Above, use exitCode as 0 (zero) to show that the process completed successfully.
Use exitCode as a non-zero number to show an error, for example −
Environment.Exit(1)
Return a value 1 to show that the file you want is not present
Environment.Exit(2)exit
Return a value 2 to indicate that the file is in an incorrect format.
- Related Articles
- Difference Between exit(0) and exit(1)
- What is the equivalent of C# namespace in Java?
- What is the Java equivalent to MySQL's smallint?
- What is the C# equivalent to Java's isInstance()?
- What is the equivalent of Java static methods in Kotlin?
- What is the equivalent of Java static final fields in Kotlin?
- What is the equivalent of Java long in the context of MySQL variables?
- What is the Certainty Equivalent Method?
- For the following system of equation determine the value of $k$ for which the given system has no solution:.$2x-ky+3=0$ and $3x+2y-1=0$.
- What is the purpose of System class in Java?
- What is the C++ equivalent of sprintf?
- What is the MySQL SELECT INTO Equivalent?
- What is Python equivalent of the ! operator?
- What is Java Unicode System?
- What is exit() function in C language?

Advertisements