How do Specify the Exit Code of Console Application in .NET?

There are times when you want to specify the exit code from the Main function for example when working on the Console Application in .NET .

How do Specify the Exit Code of Console Application in .NET?

You can use the Environment.Exit to specify the exit code in the Console Application.