Swipe
SwipeSwipe
Swipe Apps

Paths

Motivation

Information

C# Program Structure · Lesson 10 of 27

Classes

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 home for its code — that's exactly what a class gives it. 🏠

In C#, the code you write typically lives inside a class. A class is like a container or blueprint that holds your program's code together — its data and the actions it can perform.

class Program
{

}
The keyword "class" followed by the name of the class — here the class is called "Program".
🤖
Notice how 'public' opens the door for other code to use this class. 🚪

The keyword "class" tells the C# compiler: "A new class starts here." Sometimes it is preceded by "public" — this means the class is visible and usable from other parts of a larger project, not just within its own file.

public class Car
{

}
This is also a valid (still empty) class — it's simply called "Car" instead of "Program".
Fill in the blank

In C#, the code you write typically belongs inside a ____.

🤖
Capital letters for class names — small rule, big consistency win. 🔤

By convention, a class name starts with a capital letter and uses "PascalCase" for multiple words — for example "Program", "Car", or "BankAccount". This isn't a strict compiler rule, but practically every C# developer follows it so code looks consistent for everyone.

Quick check

What best describes a class in C#?

🤖
Every C# program needs at least one of these to get anywhere. 🏗️

For everything you'll learn in this level, a C# program's code is housed inside at least one class. Next, we'll look at how a program inside such a class actually starts running: with the Main() method.

True or false

A class name conventionally starts with a lowercase letter in C#.

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 →