C# topic hubs
Each hub explains one family of C# language features: what problem they solve, the version that introduced each, a compiled sample per feature, the pitfalls, and how to choose between them. Together the twelve hubs cover every feature on this site, from C# 1.0 to C# 15. If you are new to C#, finish the C# basics tutorials first; the hubs assume you know classes, methods and interfaces.
Learning path
Section titled βLearning pathβRead the hubs in this order. The early hubs cover features you meet in every file; the later ones build on them or matter mainly in specific kinds of code.
- Types and records: how C# models data beyond plain classes:
var, tuples, deconstruction, discards, records, closed hierarchies and union types. - Object construction and initialization: every way to create and initialize an object, from auto-properties and object initializers to
init,required,withand primary constructors. - Methods and lambdas: shorter and more flexible members: expression bodies, local functions,
outvariables,nameof,paramscollections and extension members. - Control flow and operators: loop control including labeled
breakandcontinue, throw expressions, checked arithmetic and operators you can define yourself. - Null handling: nullable reference types and the operators that make null checks short and safe.
- Pattern matching: testing the shape of data with patterns and
switchexpressions; it pairs naturally with records and unions from the first hub. - String literals and interpolation: building text with interpolation and raw literals, and doing it without allocations.
- Collections and queries: collection expressions, slicing with indices and ranges, iterators, lambdas and LINQ.
- Resource management: releasing files, connections and other resources deterministically with
using. - Async and await: asynchronous methods and async entry points.
- Code organization: structuring files and projects: top-level statements, namespaces, global usings, file-based apps and attributes.
- Memory and performance: spans, ref semantics, struct design, generic math and unsafe code for hot paths and libraries.
Where to go next
Section titled βWhere to go nextβ- C# features by topic: the same hubs as a one-page table.
- C# versions: what each release added, with full release guides for C# 5 and C# 12 to the C# 16 preview.
- C# interview questions: questions that cut across the hubs.