CSharp - Your First Statements


The source code of Program.cs looks like this:

using System; 

namespace My_first_program 
    class Program 
        static void Main(string[] args) 
            // Output of text to the user 
            Console.WriteLine("I am starting to program in C#."); 

            // Waiting for Enter 

What do these statements do?

Console.WriteLine outputs (writes) a single line to the user.

Console.ReadLine reads a line of text that the user enters with the keyboard.

In the code above, the purpose of the statement is to make your program wait for the user to press Enter when everything is done.

In this way the program window does not disappear immediately.

Everything following the two slashes // until the end of a corresponding line is ignored.

This text contains your remarks. Visual Studio colors them in green.