If the values are not going to be changed after creation, then using a ** record struct **, and potentially even ** readonly record struct ** if data is immutable. The reason for doing this is that Object.Equals compares the values of the record, and not the reference.
Records (C# reference) - value equality
Records: Immutability
Record Struct c# 10
If the values are not going to be changed after creation, then using a ** record struct **, and potentially even ** readonly record struct ** if data is immutable. The reason for doing this is that Object.Equals compares the values of the record, and not the reference.
Records (C# reference) - value equality
Records: Immutability
Record Struct c# 10