C# Cheat Sheet

This section documents C# 14 on .NET 10 (LTS), as published at learn.microsoft.com/dotnet/csharp, which is the reference these pages are written and verified against. Features introduced by C# 15 / .NET 11 are still in preview and are always flagged as such — never presented as baseline.

This content was generated with the assistance of AI and should be verified against learn.microsoft.com before being relied on in production.

This section’s bibliography lists the reference material consulted while preparing these pages.

A single-page, colour-coded summary of the C# essentials — the program and type shapes, built-in types and literals, string interpolation and raw string literals, the operator table with ??, ?., ^, .., is and switch, control-flow one-liners, method parameters (ref/out/in/params), class, struct, record, interface and enum skeletons, properties with init, required and the C# 14 field keyword, primary constructors, generics and their constraints, every pattern-matching form, delegates, lambdas and events, extension members, LINQ in both query and method syntax with the most-used operators, collection expressions and the common collections, nullable annotations, exceptions and guard helpers, using/IDisposable, async/await idioms, lock/Interlocked/Parallel, Span<T> and stackalloc, attributes and reflection one-liners, the dotnet CLI and the .csproj essentials, xUnit facts and theories, and the naming conventions — handy for quick memorization or as a printable desk reference.

Features added in C# 12, 13 and 14 are marked with their version on the sheet, so it doubles as an upgrade checklist.

For the full explanation, every option, and additional examples, see the dedicated pages:

Error handling and resources — Exceptions and Error Handling and Memory Management and Disposal.

Concurrency and asynchrony — Async and Await and Threads and Synchronization.