Free tutorial · 22 lessons
C# Tutorial
Learn C# and .NET step by step: variables, strings, control flow, methods, classes, interfaces, records, generics, collections, LINQ, exceptions, nullable types, async/await, files and JSON — every example shown with its output.
C# Basics
- C# Introduction — What C# and .NET are, what you can build, and a first program.
- C# Get Started — Install the .NET SDK, create a console app and run it.
- C# Syntax and Output — Statements, blocks, comments, Console.WriteLine and string interpolation.
- C# Variables and Data Types — Declare typed variables, use var, const and the built-in types.
- C# Strings — String methods, comparison, verbatim and raw strings, and StringBuilder.
- C# Operators and Math — Arithmetic, comparison, logical, null operators and the Math class.
- C# History & Versions — How Microsoft created C# and .NET, how they became open source and cross-platform, every C# version from 1.0 to 14 on one timeline, and which .NET version to use today.
Control Flow
- C# If Else and Switch — Conditions, switch statements and switch expressions with patterns.
- C# Loops — for, while, do-while, foreach, break and continue.
- C# Arrays — Single and multi-dimensional arrays, indexes, ranges and Array methods.
- C# Methods — Define methods with parameters, defaults, named arguments, out/ref and overloading.
Object-Oriented C#
- C# Classes and Objects — Classes, constructors, fields, properties and methods.
- C# Inheritance and Interfaces — Base classes, virtual/override, abstract classes and interfaces.
- C# Records, Structs and Enums — Immutable records with value equality, structs and enums.
- C# Generics — Generic classes and methods with type constraints.
Collections and LINQ
- C# Lists and Dictionaries — List<T>, Dictionary<TKey,TValue>, HashSet<T> and collection expressions.
- C# LINQ — Query collections with Where, Select, OrderBy, GroupBy and aggregates.
Advanced C#
- C# Exceptions — try, catch, finally, throw, custom exceptions and using.
- C# Nullable Reference Types — string vs string?, null warnings and safe null handling.
- C# Async and Await — Task, async/await, Task.WhenAll and cancellation.
- C# Files and JSON — Read and write files with File, and serialize JSON with System.Text.Json.
Next Steps
- C# Next Steps — ASP.NET Core, Entity Framework, testing and interview practice.