C# Comments

In this lesson, using of single line comments and multi line comments are explained and examples are also included in the tutorial.

C# Comments

C# Single Line Comments:

//This is a single line comment

Single Line Comment Examples:

class Program
{
    static void Main(string[] args)
    {
        // Console.WriteLine("Hello World");
        // This line will not be executed
        Console.WriteLine("Hello Vitademy");
        //Output is: Hello Vitademy
    }
}

 

C# Multi Line Comments:

/*
These lines
are comments
*/

Multi Line Comment Examples:

static void Main(string[] args)
{
    /*
        Console.WriteLine("Hello World");
        This lines will not be executed
    */
    Console.WriteLine("Hello Vitademy");
}