C# Tutorial: Getting Started with C#
Write your first C# program, understand the class structure, and get comfortable with Console.WriteLine.
Your first C# program
C# is a modern, object-oriented language created by Microsoft. Every C# program has a `Main` method as its entry point.
`Console.WriteLine()` prints a line to the console — the equivalent of `fmt.Println` in Go or `print()` in Python.
What you'll learn in this C# getting started with c# tutorial
This interactive C# tutorial has 8 hands-on exercises. Estimated time: 12 minutes.
- Hello, C# — Every C# program starts at the `Main` method inside a class.
- Print multiple lines — Each `Console.WriteLine()` prints a separate line.
- Print with Write (no newline) — `Console.Write()` prints without adding a newline. Use it to build output piece by piece.
- Print numbers and variables — C# can print numbers directly. Use `{}` as a format placeholder:
- String interpolation — Modern C# uses `$"..."` for string interpolation — put expressions inside `{}`:
- Comments — C# has three comment styles:
- Fix the syntax error — This program has a bug. Run it, read the error, and fix it.
- Write from scratch — Write a C# program that prints:
C# Getting Started with C# concepts covered
- Your first C# program