See Your Program Twice
Approach #1
With the first approach, your code will look identical to that in the original Hello World program. Instead of making a modification to the code, you simply run it in release mode (without debugging) by pressing Ctrl + F5.
Approach #2
Below is the code for the second approach, which involves adding in Console.ReadKey(); to the end of your code. This forces your program to wait at the end until you press a key.
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace HelloWorld { class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); Console.ReadKey(); } } }
Combining the Two
If you add in Console.ReadKey(); and run in release mode, you'll have to press a key twice to end the program. This is because your code will include the line that waits for it (from Approach #2) but also, when the program ends, you'll get the normal "Press any key to continue..." statement, which you'll need to press a key for again.
Since both mechanisms are in place, and they're both waiting for a key press, you're going to have to do so twice.