05/08/2026
C # records vs classes is a common interview question, but the production risk is real: using value equality for mutable domain objects can make sets, caches, and tests behave in surprising ways.
Simple rule: records are excellent for small immutable values, DTOs, and messages. Classes are often clearer for entities that have identity and change over time.
A common mistake is answering only the syntax difference: records give value equality and nice copying. That is true, but it is not a design rule for every model.
In real projects, ask what defines sameness. If two users have the same Id but different current data, entity identity usually matters more than comparing every property.
Where do you prefer records, and where do you still use classes?