Records in C#

The feature of records in C# is underrated, but it offers substantial benefits.

Records are ideal for checking value equality between variables of the same type.

While classes require additional code to achieve value-based equality, records simplify this by automatically handling various tasks:
1. Implementing IEquatable<T> and overriding GetHashCode().
2. Overriding ToString() to aid in debugging by displaying property values.
3. Deconstructing a record into a tuple, facilitating tasks like pattern matching.
These features are encompassed within the 'record' keyword.

For applications adhering to Domain Driven Design (DDD), where types are categorized into Aggregates, Entities, and Value Objects, records are a natural fit for Value Objects.
They also fit in as models or data transfer objects (DTOs).
A key advantage of records is their immutability. Once created, a record's state cannot be altered. This characteristic aligns well with functional programming practices.

Use records in these scenarios to reduce the boilerplate code, which otherwise is required if classes are used.