What is a record struct and when would you use it?
Short answer
A record struct is a value type with record-like value semantics and equality; use it for small immutable value data where you also want stack/value copying.
Advertisement
AModel answer
A record struct is a value type with record-like value semantics and equality; use it for small immutable value data where you also want stack/value copying.
public readonly record struct Point(int X, int Y);Real-world example
Coordinates or money where value equality plus no heap allocation is desirable.