The new C# Record type
Introduced with C#9 (.Net 5) in November 2020, the new record type adds yet another way of declaring types in C#. By default record acts as reference type, like classes, but since C#10 you can also create a record struct (value type). You can also declare them using record class, but as that’s the default, you can omit the class type when doing so and declare them as just record. Record types are compiler-generated classes/structs with some predefined methods, they can be declared very lightly on coding but will then gain their features when compiled. They all follow the IEquatable interface. IEquatable : this interface ensures that they have value-based equality. This means that when comparing two of them, C# automatically compares their properties and the values inside them to…