Dotnet Records was introduced in 2020 with C#9 and highlighted a shift to Functional Programming within the language. However, in my experience, they have been under utilised and demoted to the league of DTO's, primitive obsession and anaemic classes. However, when we extending Records, the similarities to classes can mask the reasons for choosing Records.
But first, lets identify what a Record is and why I think we are miss-using them.
Let's create an example, when building a Model to represent a Person, there are a number of Properties required. If the Model is rich, there may also be a number of relationships and navigational properties. Consider a Person, with a collection of Address items. Each Address has a Electric Meter owned by an Energy Provider.
Person
FirstName: string