Skip to main content
Programming Languages

C# Tutorial with Examples.

C# tutorial: modern C# language features, .NET enterprise applications, Azure ecosystem integrations and desktop software, with real output.

Beginner

Start here — no prior experience needed

11 lessons
csharp beginner
5 min read

Learn what C# is, how the .NET ecosystem works, and where C# is used in the real world.

csharp beginner
5 min read

Install the .NET SDK, configure VS Code with the C# extension, and run your first C# program.

csharp beginner
5 min read

Understand var, explicit types, nullable reference types, const, and readonly in C#.

csharp beginner
5 min read

Understand value types vs reference types, structs, records, and boxing/unboxing in C#.

csharp beginner
5 min read

Master arithmetic, null-coalescing, null-conditional, and pattern matching operators in C#.

csharp beginner
5 min read

Master if/else, switch expressions, for/foreach/while loops, and pattern matching in C#.

csharp beginner
5 min read

C# methods by example: value, ref, out and params parameters, optional and named arguments, overloading, local functions, tuples and extension methods.

csharp beginner
5 min read

C# strings by example: immutability, interpolation and format specifiers, verbatim and raw literals, StringBuilder, Span<char> parsing and Regex.

csharp beginner
5 min read

C# arrays by example: fixed-size declaration, indices and ranges, rectangular vs jagged arrays, Array.Sort and BinarySearch, LINQ, and Span<T> slices.

csharp beginner
5 min read

C# collections by example: List<T>, Dictionary<K,V>, HashSet<T>, Queue, Stack, PriorityQueue and lazy IEnumerable<T>, with real output from each.

csharp beginner
5 min read

C# object-oriented programming by example: classes, constructors, properties, encapsulation, inheritance, virtual/override, abstract and sealed classes.

Intermediate

For developers with core concepts down

12 lessons
csharp intermediate
5 min read

Positional records, value-based equality, non-destructive mutation with with, and record struct in C#.

csharp intermediate
5 min read

C# interfaces by example: implementing contracts, segregation, explicit implementation, default interface methods, and swapping implementations for tests.

csharp intermediate
5 min read

C# generics by example: generic classes and methods, where constraints, static abstract members, a Result<T> type, and covariance vs contravariance.

csharp intermediate
5 min read

LINQ in C# by example: query vs method syntax, filtering, ordering, GroupBy, Join and left join, SelectMany, deferred execution and IQueryable.

csharp intermediate
5 min read

C# async/await by example: what await really does, Task.WhenAll vs sequential awaits, throttling, cancellation, ValueTask, async streams, async void.

csharp intermediate
5 min read

C# delegates by example: Func, Action and Predicate, lambdas and closures, multicast invocation, events and EventHandler<T>, and delegates as strategies.

csharp intermediate
5 min read

C# error handling by example: try/catch/finally, using and Dispose order, exception filters, custom exceptions, throw vs throw ex, and AggregateException.

csharp intermediate
5 min read

C# file I/O by example: the File and Directory classes, Path, StreamReader and StreamWriter, async reads, System.Text.Json, and FileSystemWatcher.

csharp intermediate
5 min read

C# pattern matching by example: type, constant, relational, property, positional and list patterns, switch expressions, and exhaustiveness warnings.

csharp intermediate
5 min read

Testing C# with xUnit by example: Fact and Theory, readable failures with FluentAssertions, Moq mocks and Verify, fixtures, async tests, and NUnit.

csharp intermediate
5 min read

ASP.NET Core by example: minimal APIs, a CRUD API driven with curl, controllers and validation, middleware order, exception handling, DI and config.

csharp intermediate
5 min read

EF Core by example on SQLite: DbContext and model, the SQL each LINQ query generates, Include vs N+1, change tracking, bulk updates, migrations.

Advanced

Production-grade patterns for experienced engineers

3 lessons