Skip to content
Guest
← All References
C# C# 12 / .NET 8+

C# & .NET Quick Reference

Essential C# 12 / .NET syntax: string interpolation, nullable operators, pattern matching, records, LINQ, and async/await.

var top = items.Where(x => x.Score >= 80).ToList();

Core Syntax, Records & Pattern Matching

FeaturePurposeExample
$"Hi {name}"String interpolationConsole.WriteLine($"Score: {n}");
x ?? fallbackNull-coalescing defaultstring u = input ?? "Guest";
val switch { ... }Switch expression + patternsn switch { >= 80 => "Pass", _ => "Retry" }
record + withImmutable value-equal modelrecord User(string Name); var u2 = u1 with { Name = "Bo" };
{ get; private set; }Encapsulated auto-propertypublic int Count { get; private set; }

LINQ & Async/Await

APIPurposeExample
.Where(p) / .Select(f)Filter and project collectionsxs.Where(x => x > 0).Select(x => x * 2)
.OrderBy() / .Sum()Sort and aggregateitems.Sum(i => i.Price)
async Task<T>Non-blocking async methodasync Task<string> FetchAsync()
await Task.WhenAll(...)Run independent tasks concurrentlyvar res = await Task.WhenAll(t1, t2);

Search courses, lessons, and references

Type to search across all courses, lessons, and quick references.

Press Esc to close Powered by Pagefind