C# & .NET (C# 14, .NET 10 LTS)
C# 14 on .NET 10 LTS, from a first one-file program to real applications: types, LINQ, async code, memory, testing and shipping, with examples that ran.
111 lessons: 27 free with Pro answers, 79 with a free core and 5 with a free intro.
Examples run with .NET 10.0.401.
Who it is for
Enterprise .NET developers, Unity game developers and Java developers moving to .NET. Beginners can start at the first module: it assumes no prior C#.
What you will be able to do
- Install and pin the .NET 10 SDK, and run C# as file-based apps and as projects with the dotnet CLI
- Choose the right numeric, text and collection types, and predict overflow, rounding and equality exactly
- Model programs with classes, structs, records, interfaces and generics, and keep them null-safe
- Query and reshape data with LINQ and pattern matching, and say when each query actually runs
- Write correct asynchronous and concurrent code with async and await, tasks, channels and locks
- Measure what code costs with Span<T>, the garbage collector and BenchmarkDotNet before optimising it
- Work with files, JSON, XML, dates, databases and HTTP safely, and build apps with hosting and DI
- Test, package and ship .NET code with xUnit v3, NuGet, Native AOT, containers and CI
- Move to C# from Java or Unity, and upgrade older .NET code to .NET 10 LTS
Revise and practise
- Practice: every exercise and quiz (111 quizzes)
Modules and lessons
What the labels mean
- Free lesson, Pro answers
- the whole lesson is free; the model answers to its interview questions open with a pass
- Free core, Pro depth
- the core of the lesson is free; its in-depth parts open with a pass
- Free intro, Pro
- the first part is free; the rest opens with a pass
- Pro
- opens with a Pro, Premium or Ultimate pass
Minutes are reading time: “6 of 15 min free” means 6 minutes of the lesson are free.
What a pass opens in this track
224 in-depth parts and 309 interview answers. The same pass opens every other track and every Pro tool.
- Module 1
Start here: C#, .NET and your first programs
What C# and .NET are, installing and pinning the SDK, file-based apps and their directives, projects and the CLI, compiler errors and debugging, console input and exit codes.
- What C# and .NET are, and which version to use Free lesson, Pro answers: 10 minutes
- Install and pin the .NET SDK Free lesson, Pro answers: 10 minutes
- Your first C# program as a file-based app Free lesson, Pro answers: 10 minutes
- Packages and settings in file-based apps Free lesson, Pro answers: 10 minutes
- Projects, solutions and the dotnet CLI Free lesson, Pro answers: 20 minutes
- Compiler errors, stack traces and debugging Free lesson, Pro answers: 20 minutes
- Console input, output, arguments and exit codes Free lesson, Pro answers: 15 minutes
- Module 2
Types, variables and operators
Variables and type inference, integer overflow and checked arithmetic, double and decimal, operators, conversions and parsing, value and reference types, and enums.
- Variables, var and constants Free lesson, Pro answers: 15 minutes
- Integers, overflow and checked arithmetic Free core, Pro depth: 6 of 15 minutes free
- double, float and decimal: money and rounding Free core, Pro depth: 6 of 15 minutes free
- Operators, precedence and expressions Free core, Pro depth: 6 of 15 minutes free
- Conversions, casting and parsing Free core, Pro depth: 5 of 15 minutes free
- Value types and reference types Free core, Pro depth: 6 of 15 minutes free
- Enums and flag enums Free core, Pro depth: 5 of 15 minutes free
- Module 3
Control flow and methods
if, switch statements and switch expressions, the four loops, methods with optional and named parameters, overloading, and ref, out and in parameters.
- if, switch statements and switch expressions Free lesson, Pro answers: 15 minutes
- Loops: for, while, do and foreach Free core, Pro depth: 8 of 20 minutes free
- Methods, parameters and overloading Free core, Pro depth: 7 of 20 minutes free
- ref, out, in and ref readonly parameters Free core, Pro depth: 6 of 15 minutes free
- Module 4
Strings and text
Comparing and slicing strings, interpolation and raw string literals, culture-aware formatting, StringBuilder, Unicode and UTF-8, and source-generated regular expressions.
- Strings: slicing, immutability and comparison Free lesson, Pro answers: 15 minutes
- Interpolation, raw strings and UTF-8 literals Free core, Pro depth: 5 of 15 minutes free
- Culture formatting: numbers, money and dates Free core, Pro depth: 6 of 15 minutes free
- StringBuilder: building long text efficiently Free core, Pro depth: 5 of 15 minutes free
- Unicode, UTF-8 and text elements Free core, Pro depth: 6 of 15 minutes free
- Regular expressions with source generation Free core, Pro depth: 6 of 15 minutes free
- Module 5
Arrays and collections
Arrays, indices and ranges, List<T> and collection expressions, dictionaries and sets, iterators with yield, immutable and frozen collections, and choosing a collection.
- Arrays, indices and ranges Free lesson, Pro answers: 15 minutes
- Lists and collection expressions Free core, Pro depth: 8 of 20 minutes free
- Dictionaries, sets and comparers Free core, Pro depth: 8 of 20 minutes free
- Iterators: IEnumerable, yield and lazy sequences Free core, Pro depth: 7 of 20 minutes free
- Read-only, immutable and frozen collections Free core, Pro depth: 7 of 20 minutes free
- Queues, stacks and priority queues: how to choose Free core, Pro depth: 9 of 25 minutes free
- Module 6
Classes, objects and encapsulation
Classes and constructors, properties and the field keyword, static members, access modifiers, primary constructors, equality and operators, and C# 14 extension members.
- Classes, objects and constructors Free lesson, Pro answers: 15 minutes
- Properties, indexers and the field keyword Free core, Pro depth: 7 of 20 minutes free
- Static members, static classes and shared state Free core, Pro depth: 7 of 20 minutes free
- Access modifiers, assemblies and file types Free core, Pro depth: 7 of 20 minutes free
- Primary constructors for classes and structs Free core, Pro depth: 8 of 20 minutes free
- Equality, hashing, operators and conversions Free core, Pro depth: 8 of 20 minutes free
- Extension methods and C# 14 extension members Free core, Pro depth: 8 of 20 minutes free
- Module 7
Inheritance, interfaces and polymorphism
Inheritance and virtual methods, abstract and sealed types, interfaces with default members, polymorphism and type tests, and classic patterns written the C# way.
- Inheritance, virtual methods and overriding Free lesson, Pro answers: 15 minutes
- Abstract classes and sealed types Free core, Pro depth: 7 of 20 minutes free
- Interfaces, explicit implementation and defaults Free core, Pro depth: 5 of 15 minutes free
- Polymorphism, casting and type tests Free core, Pro depth: 5 of 15 minutes free
- Classic design patterns in idiomatic C# Free core, Pro depth: 5 of 15 minutes free
- Module 8
Structs, records, tuples and value semantics
Structs and value semantics, records and with expressions, tuples and deconstruction, and how to choose between a class, a struct, a record and a tuple.
- Structs, readonly structs and defensive copies Free lesson, Pro answers: 15 minutes
- Records, value equality and with expressions Free core, Pro depth: 6 of 15 minutes free
- Tuples, anonymous types and deconstruction Free core, Pro depth: 6 of 15 minutes free
- Class, struct, record or tuple: how to choose Free core, Pro depth: 6 of 15 minutes free
- Module 9
Null safety
Nullable value types and the null operators, nullable reference types and flow analysis, nullability attributes, and moving an existing code base to nullable.
- Nullable value types and null operators Free lesson, Pro answers: 20 minutes
- Nullable reference types and flow analysis Free core, Pro depth: 7 of 20 minutes free
- Nullability attributes, guards and migration Free core, Pro depth: 7 of 20 minutes free
- Module 10
Pattern matching
Type, constant, property, positional, relational, logical and list patterns, and exhaustive switches that model a closed set of cases.
- Type, constant and declaration patterns Free lesson, Pro answers: 20 minutes
- Property and positional patterns Free core, Pro depth: 8 of 20 minutes free
- Relational, logical and list patterns Free core, Pro depth: 8 of 20 minutes free
- Exhaustive switches over closed sets of cases Free core, Pro depth: 8 of 20 minutes free
- Module 11
Generics
Generic types and methods, constraints, generic math with static abstract interface members, and covariance and contravariance.
- Generic types and methods Free lesson, Pro answers: 15 minutes
- Generic constraints Free core, Pro depth: 6 of 15 minutes free
- Generic math and static abstract members Free core, Pro depth: 5 of 15 minutes free
- Generic variance: covariance and contravariance Free core, Pro depth: 7 of 20 minutes free
- Module 12
Delegates, lambdas, events and functional style
Delegates, Func and Action, lambdas and closures, events and the memory leaks they can cause, and functional techniques in everyday C#.
- Delegates, Func and Action Free lesson, Pro answers: 20 minutes
- Lambdas and closures Free core, Pro depth: 8 of 20 minutes free
- Events, subscriptions and memory leaks Free core, Pro depth: 8 of 20 minutes free
- Functional techniques in C# Free core, Pro depth: 10 of 25 minutes free
- Module 13
Exceptions and resource cleanup
try, catch, finally and exception filters, designing exceptions and result types, and cleaning up resources with using, IDisposable and IAsyncDisposable.
- Exceptions: try, catch, finally and filters Free lesson, Pro answers: 20 minutes
- Designing exceptions, guard clauses and results Free core, Pro depth: 7 of 20 minutes free
- using, IDisposable and IAsyncDisposable Free core, Pro depth: 7 of 20 minutes free
- Module 14
LINQ
LINQ from the first query to grouping and joins, including LeftJoin and RightJoin, deferred execution pitfalls, IQueryable, expression trees and custom operators.
- LINQ: your first queries Free lesson, Pro answers: 15 minutes
- LINQ projection, filtering, sorting and paging Free core, Pro depth: 5 of 15 minutes free
- LINQ grouping and aggregation Free core, Pro depth: 6 of 15 minutes free
- LINQ joins: Join, GroupJoin, LeftJoin and RightJoin Free core, Pro depth: 5 of 15 minutes free
- IQueryable and expression trees Free core, Pro depth: 8 of 20 minutes free
- Module 15
Asynchronous programming
async and await from first principles, composing tasks, cancellation and timeouts, async streams, synchronisation contexts, ValueTask and thread-pool starvation.
- async and await from first principles Free lesson, Pro answers: 25 minutes
- Composing tasks: WhenAll, WhenAny and WhenEach Free core, Pro depth: 7 of 20 minutes free
- Cancellation tokens and timeouts Free core, Pro depth: 8 of 25 minutes free
- Async streams with IAsyncEnumerable Free core, Pro depth: 8 of 25 minutes free
- SynchronizationContext, ConfigureAwait and deadlocks Free core, Pro depth: 7 of 20 minutes free
- ValueTask, pooling and async overhead Free core, Pro depth: 7 of 20 minutes free
- Async pitfalls and thread-pool starvation Free core, Pro depth: 7 of 20 minutes free
- Module 16
Threads, parallelism and synchronisation
Threads and the thread pool, locks and Interlocked, concurrent collections and channels, rate limiting, Parallel and PLINQ, and timers with TimeProvider.
- Threads, the thread pool and async-local state Free lesson, Pro answers: 15 minutes
- Locks, Interlocked and the .NET memory model Free core, Pro depth: 7 of 20 minutes free
- Concurrent collections and channels Free core, Pro depth: 8 of 20 minutes free
- Throttling with SemaphoreSlim and rate limiters Free core, Pro depth: 7 of 20 minutes free
- Parallel.For, Parallel.ForEach and PLINQ Free core, Pro depth: 7 of 20 minutes free
- Module 17
Memory, Span and performance
The garbage collector, Span<T> and Memory<T>, ref structs, pooling, benchmarking with BenchmarkDotNet, the JIT and SIMD, and diagnosing with the dotnet tools.
- How the .NET garbage collector works Free lesson, Pro answers: 20 minutes
- Span<T>, ReadOnlySpan<T> and Memory<T> Free core, Pro depth: 5 of 15 minutes free
- ref structs, ref fields and scoped Free core, Pro depth: 6 of 15 minutes free
- Pooling and allocation-free code Free core, Pro depth: 5 of 15 minutes free
- Benchmarking with BenchmarkDotNet Free core, Pro depth: 7 of 20 minutes free
- JIT, dynamic PGO, ReadyToRun and SIMD Free core, Pro depth: 7 of 20 minutes free
- dotnet-counters, dotnet-trace and dotnet-dump Free core, Pro depth: 7 of 20 minutes free
- Module 18
Reflection, attributes and source generators
Reflection and dynamic and what they cost, custom and caller-info attributes, the built-in source generators, writing an incremental generator, and Roslyn analyzers.
- Reflection, dynamic and their costs Free lesson, Pro answers: 20 minutes
- Custom attributes and caller-info attributes Free core, Pro depth: 7 of 20 minutes free
- Using source generators in .NET Free core, Pro depth: 5 of 15 minutes free
- Writing an incremental source generator Free core, Pro depth: 5 of 15 minutes free
- Roslyn analyzers, code fixes and .editorconfig Free core, Pro depth: 6 of 20 minutes free
- Module 19
Files, JSON, XML, dates, databases and HTTP
Files and paths, streams and compression, JSON with System.Text.Json, secure XML parsing, dates and time zones, SQLite with ADO.NET, and HttpClient with resilience.
- Files, paths and safe file access Free lesson, Pro answers: 15 minutes
- Streams, compression and System.IO.Pipelines Free core, Pro depth: 7 of 20 minutes free
- JSON in C#: System.Text.Json and source generation Free core, Pro depth: 6 of 20 minutes free
- XML in C#: LINQ to XML and secure parsing Free core, Pro depth: 5 of 15 minutes free
- SQLite in C#: ADO.NET and parameterised queries Free core, Pro depth: 6 of 20 minutes free
- HttpClient, IHttpClientFactory and resilience Free core, Pro depth: 7 of 20 minutes free
- Module 20
Command-line apps, hosting, DI, configuration and telemetry
Command-line apps and dotnet tools, the Generic Host and dependency injection, configuration and options, logging, metrics and traces, workers and AI abstractions.
- Command-line apps with System.CommandLine and tools Free lesson, Pro answers: 20 minutes
- Generic Host and dependency injection Free intro, Pro: 4 of 15 minutes free
- Configuration and the options pattern Free intro, Pro: 4 of 15 minutes free
- Structured logging, metrics and traces Free intro, Pro: 3 of 15 minutes free
- Worker services and background jobs Free intro, Pro: 4 of 20 minutes free
- Microsoft.Extensions.AI: chat clients in C# Free intro, Pro: 3 of 15 minutes free
- Module 22
Testing C# code
Unit tests with xUnit v3 and dotnet test, test doubles, assertion libraries, snapshot and property tests, integration tests, coverage, mutation testing and a TDD kata.
- Unit tests with xUnit v3 and dotnet test Free lesson, Pro answers: 30 minutes
- Test doubles and testable design Free core, Pro depth: 12 of 30 minutes free
- Assertion libraries, snapshots and property tests Free core, Pro depth: 12 of 30 minutes free
- Integration tests with real dependencies Free core, Pro depth: 10 of 30 minutes free
- Code coverage and mutation testing Free core, Pro depth: 11 of 30 minutes free
- TDD in C#: an Indian number-to-words kata Free core, Pro depth: 11 of 30 minutes free India-specific
Related tools
Official documentation
- C# documentation (Microsoft Learn)
- What's new in C# 14 (Microsoft Learn)
- .NET fundamentals documentation (Microsoft Learn)
- .NET and .NET Core Support Policy (Microsoft (.NET))
- ECMA-334: C# language specification (Ecma International)