Records arrived in C# 9.0. They are designed for data shapes where the value matters more than the object identity.
Why it matters
Records reduce boilerplate for DTOs, messages, and other immutable models. The compiler gives you equality, ToString(), and with-based cloning behavior for free.
That makes them a strong default for API payloads and other data-transfer shapes.
Cautions
Records are not always the right fit. If the object has a strong identity, mutable state, or behavior-heavy responsibilities, a regular class may be a better model.
Also be careful with inheritance and equality rules when records participate in deeper type hierarchies.
Modeling immutable data with a record
Records are concise reference types with value-based equality and built-in support for non-destructive updates.
Valid since C# 9.0
var today = new WeatherReading("Seattle", 9.5m);
var warmer = today with { TemperatureC = 12.0m };
public record WeatherReading(string City, decimal TemperatureC);