How to add a single line comment in C# program

How to add a single line comment in C# program. In this program we can learn how to include the single line comments in C sharp. Comments can be used to explain and improve the readability of C# code. When evaluating alternative code, it can also be used to prevent execution. Two forward slashes (//) begin single-line comments. C# ignores any text between / and the end of the line (will not be executed).

using System;

namespace Main
{
class Program
{
static void Main(string[] args)
{
// This is a comment
Console.WriteLine("Hello World");
}
}
}

Hello World

What is purpose of the using system in c sharp

In C#, namespaces are used to arrange a large number of classes so that the program can be easily managed. System is used in a basic C# program. Console is a class that belongs to the System namespace. We must use namespacename to get the class of a namespace.

Uses of Static void main(string[] args)

The Main method describes what the class does when it is run and creates additional objects and variables. Because it is accessible to run when the C# program starts, a main method is static. It is the program’s starting point, and it runs without even creating a class object.

What is namespace in C# programming language

The purpose of a namespace is to provide a means to keep one set of names from interfering with another. No conflict exists between class names declared in different namespaces.