C# 14 · Records, classes and pattern matching

Test and unpack a type

Check a type and bind it to a variable in one expression.

if (shape is Circle { Radius: > 10 } c)
    Console.WriteLine(c.Radius);

Official C# 14 documentation

More records, classes and pattern matching commands

All records, classes and pattern matching commands · C# 14 cheatsheet

Was this page helpful?