The Main() Method
A free lesson from Swipe Coding · C#, level 1 · updated October 2026
By the Swipe team, founded by Colin · how we make lessons
Every C# program needs a starting point — a place where execution begins. This starting point is a very specific method called Main(). When you start a C# program, the Common Language Runtime (CLR) automatically looks for this method.
class Program
{
static void Main()
{
Console.WriteLine("Hello, C#!");
}
}The line "static void Main()" is called the method's signature. "static" means the method belongs to the class itself (you don't need an object to start it), and "void" means the method doesn't return a value. Note the capital "M" in "Main" — this is different from languages where the entry point is lowercase, so it's an easy detail to trip over.
What does the CLR look for to start a C# program?
If the method name isn't exactly right — for example "main" with a lowercase "m" — it will not be recognized as the program's entry point. Capitalization matters everywhere in C#, and the Main() method is a perfect example of why.
For a C# program to start, the CLR looks for a method called ____ (with a capital first letter).
Inside the Main() method, you write your program's actual statements — they are executed step by step, in the order they appear. We'll take a closer look at exactly what a "statement" is in the next lesson. (You may also spot a newer, shorter style called "top-level statements" in modern C# code, which skips writing the class and Main() by hand for small programs — but understanding the classic form first makes that shortcut much easier to understand later.)
In C#, the program's entry point method must be named exactly "Main", with a capital M.
Keep your streak going in Swipe Coding
Swipe through every level of C# on your iPhone — with XP, stars, streaks, a personal advisor and the full track beyond these free levels.
Get the Swipe apps →