Every C# program starts in a method called Main. That is the entry point — the line the runtime jumps to when your program starts.
Program.cs
using System;
class Program
{
static void Main()
{
Console.WriteLine("Hello, C#!");
}
}
Output
Hello, C#!
Three things are happening:
using System;brings in the basics, includingConsole.class Programis a container. C# puts all code inside a class.Mainis where execution begins.
Semicolons
Every statement ends with ;. Forgetting one is the most common beginner error, and the compiler will point straight at it.