Multiple choice technology programming languages

To quit a c# application the following should be used?

  1. Application.Exit();

  2. System.Environment.Exit(0)

  3. System.Environment.Exit(1)

  4. All the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

All listed methods can terminate a C# application. Application.Exit() informs all message loops to terminate, which is suitable for Windows Forms. System.Environment.Exit(0) and System.Environment.Exit(1) terminate the process immediately and return exit codes to the operating system, representing success and failure respectively.