C# 14 · Records, classes and pattern matching
Copy a record with changes
Create a modified copy and leave the original unchanged.
var older = ada with { Age = 37 };
More records, classes and pattern matching commands
- Declare an immutable data type
- Declare a class with a primary constructor
- Require properties at creation
- Customize an auto-property
- Choose a value with a switch expression
- Test and unpack a type
All records, classes and pattern matching commands · C# 14 cheatsheet