Swipe
SwipeSwipe
Swipe Apps

Paths

Motivation

Information

C# Program Structure · Lesson 11 of 27

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 exactly one starting line — this is it. 🚀

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#!");
    }
}
As soon as you start this program, the CLR finds the Main() method and begins execution right there.
🤖
This is a fun one to get right — capitalization matters here! 🔠

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.

Quick check

What does the CLR look for to start a C# program?

🤖
Even one wrong letter here and things will not start as expected. ⚠️

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.

Fill in the blank

For a C# program to start, the CLR looks for a method called ____ (with a capital first letter).

🤖
Next up: what exactly counts as a 'statement' in C#. ➡️

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.)

True or false

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 →