3 ms·
C# has had records slated for years without delivery, alas. Thankfully we do finally have a version in testing. In any case to answer GP, structs should not be
by to11mtm 7y ago
C# has had records slated for years without delivery, alas. Thankfully we do finally have a version in testing.
In any case to answer GP, structs should not be considered a valid substitute for records, they are 'value types' so passing them around means you copy all the data every time you pass (i.e. lots of allocations if the record is larger than 1 or 2 fields)
Properties get you 'closer'. You can do some code
Which is a good bit less than Java by default (i.e. not Lombok or similar)
F# does have Records, and technically there's nothing stopping you from declaring your records in F# and importing them into C#... but that may not be ideal. I don't think you get the full benefits (like copying a record with specific properties changed)