C# Fundamentals - Third Edition

When learning a new programming language, it is a tradition to display the words “Hello World!” on the screen. Please note, this is the only example in the book where an explanation is not provided about the coding and simply the instructions are given to produce the results.

Walkthrough: Hello World

1. Create a Console application named HelloWorld. The steps to create a Console application can be found in the previous section “Visual Studio: Console Application Setup”.  

2. A page full of unfamiliar code should appear and look like the image below. By default, Console applications display “Hello World!”. Please note, the file “Program.cs” should automatically load, if it does not double click it from the Solution Explorer menu.

 

3. Add the line of code “ReadLine();” below “Console.WriteLine("Hello World!");”. This line of code will prevent the Console app from closing right after it displays “Hello World!”.

 

4. Press the play button or the F5 key to run the Console application.

Congratulations on completing a C# program!