DEV Community

Sharad Aade
Sharad Aade

Posted on

Hello World in C#

using System;

namespace FirstProgram
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World");
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

The System namespace contains fundamental classes and base classes that define commonly used types, events, interfaces, and more.

Namespace => A namespace is a way to organise classes, structs, interfaces, enums, and delegates to avoid naming conflicts and improve code readability.

It acts like a container that helps distinguish between classes with the same name (e.g., if two libraries define an Animal class, namespaces prevent confusion).

Main => The Main method is the entry point of the program.

Image description

Console is a class that has a WriteLine() method.

Top comments (0)