Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StorageObject: can it be made "record" instead of a class #21

Open
benrussill opened this issue Mar 17, 2022 · 1 comment
Open

StorageObject: can it be made "record" instead of a class #21

benrussill opened this issue Mar 17, 2022 · 1 comment

Comments

@benrussill
Copy link

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

@LuckyWraptor
Copy link
Contributor

Wouldn't work with Newtonsoft JSON for compatibility version builds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants