Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

Programming languages

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 to read 21 modules

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

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.

  1. 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.

    1. What C# and .NET are, and which version to use Beginner Free lesson, Pro answers: 10 minutes
    2. Install and pin the .NET SDK Beginner Free lesson, Pro answers: 10 minutes
    3. Your first C# program as a file-based app Beginner Free lesson, Pro answers: 10 minutes
    4. Packages and settings in file-based apps Beginner Free lesson, Pro answers: 10 minutes
    5. Projects, solutions and the dotnet CLI Beginner Free lesson, Pro answers: 20 minutes
    6. Compiler errors, stack traces and debugging Beginner Free lesson, Pro answers: 20 minutes
    7. Console input, output, arguments and exit codes Beginner Free lesson, Pro answers: 15 minutes
  2. 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.

    1. Variables, var and constants Beginner Free lesson, Pro answers: 15 minutes
    2. Integers, overflow and checked arithmetic Beginner Free core, Pro depth: 6 of 15 minutes free
    3. double, float and decimal: money and rounding Beginner Free core, Pro depth: 6 of 15 minutes free
    4. Operators, precedence and expressions Beginner Free core, Pro depth: 6 of 15 minutes free
    5. Conversions, casting and parsing Beginner Free core, Pro depth: 5 of 15 minutes free
    6. Value types and reference types Beginner Free core, Pro depth: 6 of 15 minutes free
    7. Enums and flag enums Beginner Free core, Pro depth: 5 of 15 minutes free
  3. 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.

    1. if, switch statements and switch expressions Beginner Free lesson, Pro answers: 15 minutes
    2. Loops: for, while, do and foreach Beginner Free core, Pro depth: 8 of 20 minutes free
    3. Methods, parameters and overloading Beginner Free core, Pro depth: 7 of 20 minutes free
    4. ref, out, in and ref readonly parameters Intermediate Free core, Pro depth: 6 of 15 minutes free
  4. 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.

    1. Strings: slicing, immutability and comparison Beginner Free lesson, Pro answers: 15 minutes
    2. Interpolation, raw strings and UTF-8 literals Beginner Free core, Pro depth: 5 of 15 minutes free
    3. Culture formatting: numbers, money and dates Intermediate Free core, Pro depth: 6 of 15 minutes free
    4. StringBuilder: building long text efficiently Intermediate Free core, Pro depth: 5 of 15 minutes free
    5. Unicode, UTF-8 and text elements Intermediate Free core, Pro depth: 6 of 15 minutes free
    6. Regular expressions with source generation Intermediate Free core, Pro depth: 6 of 15 minutes free
  5. 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.

    1. Arrays, indices and ranges Beginner Free lesson, Pro answers: 15 minutes
    2. Lists and collection expressions Beginner Free core, Pro depth: 8 of 20 minutes free
    3. Dictionaries, sets and comparers Beginner Free core, Pro depth: 8 of 20 minutes free
    4. Iterators: IEnumerable, yield and lazy sequences Intermediate Free core, Pro depth: 7 of 20 minutes free
    5. Read-only, immutable and frozen collections Intermediate Free core, Pro depth: 7 of 20 minutes free
    6. Queues, stacks and priority queues: how to choose Intermediate Free core, Pro depth: 9 of 25 minutes free
  6. 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.

    1. Classes, objects and constructors Beginner Free lesson, Pro answers: 15 minutes
    2. Properties, indexers and the field keyword Beginner Free core, Pro depth: 7 of 20 minutes free
    3. Static members, static classes and shared state Intermediate Free core, Pro depth: 7 of 20 minutes free
    4. Access modifiers, assemblies and file types Intermediate Free core, Pro depth: 7 of 20 minutes free
    5. Primary constructors for classes and structs Intermediate Free core, Pro depth: 8 of 20 minutes free
    6. Equality, hashing, operators and conversions Intermediate Free core, Pro depth: 8 of 20 minutes free
    7. Extension methods and C# 14 extension members Intermediate Free core, Pro depth: 8 of 20 minutes free
  7. 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.

    1. Inheritance, virtual methods and overriding Intermediate Free lesson, Pro answers: 15 minutes
    2. Abstract classes and sealed types Intermediate Free core, Pro depth: 7 of 20 minutes free
    3. Interfaces, explicit implementation and defaults Intermediate Free core, Pro depth: 5 of 15 minutes free
    4. Polymorphism, casting and type tests Intermediate Free core, Pro depth: 5 of 15 minutes free
    5. Classic design patterns in idiomatic C# Intermediate Free core, Pro depth: 5 of 15 minutes free
  8. 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.

    1. Structs, readonly structs and defensive copies Intermediate Free lesson, Pro answers: 15 minutes
    2. Records, value equality and with expressions Intermediate Free core, Pro depth: 6 of 15 minutes free
    3. Tuples, anonymous types and deconstruction Intermediate Free core, Pro depth: 6 of 15 minutes free
    4. Class, struct, record or tuple: how to choose Intermediate Free core, Pro depth: 6 of 15 minutes free
  9. 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.

    1. Nullable value types and null operators Beginner Free lesson, Pro answers: 20 minutes
    2. Nullable reference types and flow analysis Intermediate Free core, Pro depth: 7 of 20 minutes free
    3. Nullability attributes, guards and migration Intermediate Free core, Pro depth: 7 of 20 minutes free
  10. Module 10

    Pattern matching

    Type, constant, property, positional, relational, logical and list patterns, and exhaustive switches that model a closed set of cases.

    1. Type, constant and declaration patterns Beginner Free lesson, Pro answers: 20 minutes
    2. Property and positional patterns Intermediate Free core, Pro depth: 8 of 20 minutes free
    3. Relational, logical and list patterns Intermediate Free core, Pro depth: 8 of 20 minutes free
    4. Exhaustive switches over closed sets of cases Intermediate Free core, Pro depth: 8 of 20 minutes free
  11. Module 11

    Generics

    Generic types and methods, constraints, generic math with static abstract interface members, and covariance and contravariance.

    1. Generic types and methods Intermediate Free lesson, Pro answers: 15 minutes
    2. Generic constraints Intermediate Free core, Pro depth: 6 of 15 minutes free
    3. Generic math and static abstract members Advanced Free core, Pro depth: 5 of 15 minutes free
    4. Generic variance: covariance and contravariance Advanced Free core, Pro depth: 7 of 20 minutes free
  12. 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#.

    1. Delegates, Func and Action Intermediate Free lesson, Pro answers: 20 minutes
    2. Lambdas and closures Intermediate Free core, Pro depth: 8 of 20 minutes free
    3. Events, subscriptions and memory leaks Intermediate Free core, Pro depth: 8 of 20 minutes free
    4. Functional techniques in C# Intermediate Free core, Pro depth: 10 of 25 minutes free
  13. 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.

    1. Exceptions: try, catch, finally and filters Intermediate Free lesson, Pro answers: 20 minutes
    2. Designing exceptions, guard clauses and results Intermediate Free core, Pro depth: 7 of 20 minutes free
    3. using, IDisposable and IAsyncDisposable Intermediate Free core, Pro depth: 7 of 20 minutes free
  14. 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.

    1. LINQ: your first queries Beginner Free lesson, Pro answers: 15 minutes
    2. LINQ projection, filtering, sorting and paging Intermediate Free core, Pro depth: 5 of 15 minutes free
    3. LINQ grouping and aggregation Intermediate Free core, Pro depth: 6 of 15 minutes free
    4. LINQ joins: Join, GroupJoin, LeftJoin and RightJoin Intermediate Free core, Pro depth: 5 of 15 minutes free
    5. IQueryable and expression trees Advanced Free core, Pro depth: 8 of 20 minutes free
  15. Module 15

    Asynchronous programming

    async and await from first principles, composing tasks, cancellation and timeouts, async streams, synchronisation contexts, ValueTask and thread-pool starvation.

    1. async and await from first principles Intermediate Free lesson, Pro answers: 25 minutes
    2. Composing tasks: WhenAll, WhenAny and WhenEach Intermediate Free core, Pro depth: 7 of 20 minutes free
    3. Cancellation tokens and timeouts Intermediate Free core, Pro depth: 8 of 25 minutes free
    4. Async streams with IAsyncEnumerable Advanced Free core, Pro depth: 8 of 25 minutes free
    5. SynchronizationContext, ConfigureAwait and deadlocks Advanced Free core, Pro depth: 7 of 20 minutes free
    6. ValueTask, pooling and async overhead Advanced Free core, Pro depth: 7 of 20 minutes free
    7. Async pitfalls and thread-pool starvation Advanced Free core, Pro depth: 7 of 20 minutes free
  16. 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.

    1. Threads, the thread pool and async-local state Intermediate Free lesson, Pro answers: 15 minutes
    2. Locks, Interlocked and the .NET memory model Advanced Free core, Pro depth: 7 of 20 minutes free
    3. Concurrent collections and channels Advanced Free core, Pro depth: 8 of 20 minutes free
    4. Throttling with SemaphoreSlim and rate limiters Advanced Free core, Pro depth: 7 of 20 minutes free
    5. Parallel.For, Parallel.ForEach and PLINQ Advanced Free core, Pro depth: 7 of 20 minutes free
  17. 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.

    1. How the .NET garbage collector works Advanced Free lesson, Pro answers: 20 minutes
    2. Span<T>, ReadOnlySpan<T> and Memory<T> Advanced Free core, Pro depth: 5 of 15 minutes free
    3. ref structs, ref fields and scoped Advanced Free core, Pro depth: 6 of 15 minutes free
    4. Pooling and allocation-free code Advanced Free core, Pro depth: 5 of 15 minutes free
    5. Benchmarking with BenchmarkDotNet Advanced Free core, Pro depth: 7 of 20 minutes free
    6. JIT, dynamic PGO, ReadyToRun and SIMD Advanced Free core, Pro depth: 7 of 20 minutes free
    7. dotnet-counters, dotnet-trace and dotnet-dump Advanced Free core, Pro depth: 7 of 20 minutes free
  18. 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.

    1. Reflection, dynamic and their costs Advanced Free lesson, Pro answers: 20 minutes
    2. Custom attributes and caller-info attributes Intermediate Free core, Pro depth: 7 of 20 minutes free
    3. Using source generators in .NET Advanced Free core, Pro depth: 5 of 15 minutes free
    4. Writing an incremental source generator Advanced Free core, Pro depth: 5 of 15 minutes free
    5. Roslyn analyzers, code fixes and .editorconfig Advanced Free core, Pro depth: 6 of 20 minutes free
  19. 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.

    1. Files, paths and safe file access Intermediate Free lesson, Pro answers: 15 minutes
    2. Streams, compression and System.IO.Pipelines Advanced Free core, Pro depth: 7 of 20 minutes free
    3. JSON in C#: System.Text.Json and source generation Intermediate Free core, Pro depth: 6 of 20 minutes free
    4. XML in C#: LINQ to XML and secure parsing Intermediate Free core, Pro depth: 5 of 15 minutes free
    5. SQLite in C#: ADO.NET and parameterised queries Intermediate Free core, Pro depth: 6 of 20 minutes free
    6. HttpClient, IHttpClientFactory and resilience Advanced Free core, Pro depth: 7 of 20 minutes free
  20. 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.

    1. Command-line apps with System.CommandLine and tools Intermediate Free lesson, Pro answers: 20 minutes
    2. Generic Host and dependency injection Intermediate Free intro, Pro: 4 of 15 minutes free
    3. Configuration and the options pattern Intermediate Free intro, Pro: 4 of 15 minutes free
    4. Structured logging, metrics and traces Intermediate Free intro, Pro: 3 of 15 minutes free
    5. Worker services and background jobs Advanced Free intro, Pro: 4 of 20 minutes free
    6. Microsoft.Extensions.AI: chat clients in C# Intermediate Free intro, Pro: 3 of 15 minutes free
  21. 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.

    1. Unit tests with xUnit v3 and dotnet test Intermediate Free lesson, Pro answers: 30 minutes
    2. Test doubles and testable design Intermediate Free core, Pro depth: 12 of 30 minutes free
    3. Assertion libraries, snapshots and property tests Advanced Free core, Pro depth: 12 of 30 minutes free
    4. Integration tests with real dependencies Advanced Free core, Pro depth: 10 of 30 minutes free
    5. Code coverage and mutation testing Advanced Free core, Pro depth: 11 of 30 minutes free
    6. TDD in C#: an Indian number-to-words kata Intermediate Free core, Pro depth: 11 of 30 minutes free India-specific

Related tools

Official documentation

More in Programming languages

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.