Skip to content

C# features by topic

Every C# language feature on this site is explained once, in one of twelve topic hubs. Each hub groups the features that solve the same kind of problem, opens with a table of its features and the C# version that introduced each, and gives every feature its own section with a compiled sample, pitfalls and interview questions. Use this page to find the right hub; use C# versions when you need to know what a particular release added.

Hub What it covers
Types and records var, the default literal, tuples, deconstruction, discards, records, closed hierarchies, union types and dynamic.
Object construction and initialization Properties of every kind, indexers, target-typed new, init, required, with, primary constructors and partial members.
Methods and lambdas Expression-bodied members, local functions, out variables, nameof, params collections, extension methods and members, and default interface methods.
Control flow and operators break and continue, labeled loops, throw expressions, checked arithmetic, >>> and user-defined compound assignment.
Null handling Nullable value and reference types, ?., ??, ??= and null-conditional assignment.
Pattern matching Type, constant, relational, property and list patterns, and switch expressions.
String literals and interpolation String interpolation, raw string literals, interpolated string handlers and UTF-8 literals.
Collections and queries Collection expressions, indices and ranges, iterators, lambdas, anonymous types, LINQ and IQueryable.
Resource management The using statement, using declarations and await using.
Async and await Asynchronous methods and async Main.
Code organization Top-level statements, file-scoped namespaces, global usings, file-based apps and attributes.
Memory and performance Span<T>, span conversions, ref locals and returns, readonly and ref structs, generic math and unsafe code.

The topic hubs overview lists the same hubs as an ordered reading path.

  • New to C#: start with the four C# basics tutorials, then read the hubs in order.
  • Upgrading a codebase: read the release guide for your target version on the C# versions page.
  • Preparing for an interview: each hub ends with interview questions, and C# interview questions collects more.