Multiple Line Comment in C#

Multiple Line Comment in C#. In this program, we can print the output with multiple lines of output. /* and */ begin and end multi-line comments. C# ignores any text between /* and */.

using System;

namespace Main
{
class Program
{
static void Main(string[] args)
{
/* The code below will print the words Hello World
to the screen and this will help you to learn programming at
inlarn.com*/
Console.WriteLine("Hello World!");
}
}
}

 

Output:

Hello World!

Why C# Needs System and Namespace

C# uses namespaces to organise a large number of classes for easy management. Basic C# programme uses the system class. Console is a class in the System namespace that is used to display text. Use namespacename to get a namespace’s class. When a class is run, the Main method explains what happens and produces extra objects and variables. A main method is static since it is available to run when the C# program starts. A class object is not created at the beginning of the programme.

Class and Why Do We Need in C#

Objects are formed from a class, which is a user-defined blueprint. In essence, a class is a collection of fields and methods member functions that specify actions. Classes in C# support polymorphism, inheritance, and the notions of derived classes and base classes, among other things.