Learn C# – all lessons
16 lessons from beginner to advanced, building on each other and with code examples.
Hello World & Top-Level Statements
Your first C# program and how output works.
Variables & Data Types
Numbers, text, booleans, var and conversions.
Conditions: if, switch & Co.
Making decisions in code, including with switch expressions.
Loops: for, foreach, while
Repeating tasks – over numbers and collections.
Methods
Reusable building blocks of code with parameters and return values.
Arrays, Lists, Dictionaries, Sets
The most important collection types and how to use them.
Classes, Inheritance & Records
Custom data types with properties, behavior and value semantics.
Nullable Reference Types
Catch null errors at compile time.
LINQ: Querying Data
Filter, transform, sort and group with one consistent syntax.
Error Handling & Files
Exceptions, custom error types and working safely with files.
Pattern Matching
Elegantly test and deconstruct types, properties and structures.
async/await & Tasks
Concurrent I/O without blocked threads.
Interfaces & Generics
Define contracts and write type-safe, reusable code.
Delegates, Lambdas & Events
Pass functions as values and react to events.
Value Types, IDisposable & Span
How memory, copies and resources work in .NET.
Modern C# 10–12
Primary constructors, collection expressions, raw strings and more.