Skip to content

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.

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.

  1. Types and records: how C# models data beyond plain classes: var, tuples, deconstruction, discards, records, closed hierarchies and union types.
  2. Object construction and initialization: every way to create and initialize an object, from auto-properties and object initializers to init, required, with and primary constructors.
  3. Methods and lambdas: shorter and more flexible members: expression bodies, local functions, out variables, nameof, params collections and extension members.
  4. Control flow and operators: loop control including labeled break and continue, throw expressions, checked arithmetic and operators you can define yourself.
  5. Null handling: nullable reference types and the operators that make null checks short and safe.
  6. Pattern matching: testing the shape of data with patterns and switch expressions; it pairs naturally with records and unions from the first hub.
  7. String literals and interpolation: building text with interpolation and raw literals, and doing it without allocations.
  8. Collections and queries: collection expressions, slicing with indices and ranges, iterators, lambdas and LINQ.
  9. Resource management: releasing files, connections and other resources deterministically with using.
  10. Async and await: asynchronous methods and async entry points.
  11. Code organization: structuring files and projects: top-level statements, namespaces, global usings, file-based apps and attributes.
  12. Memory and performance: spans, ref semantics, struct design, generic math and unsafe code for hot paths and libraries.