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

Make all structs readonly when possible #707

Merged
merged 2 commits into from
Oct 18, 2023
Merged

Make all structs readonly when possible #707

merged 2 commits into from
Oct 18, 2023

Conversation

BobLd
Copy link
Collaborator

@BobLd BobLd commented Oct 1, 2023

No description provided.

Copy link
Member

@EliotJones EliotJones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this improve performance or is the benefit mainly code quality and compiler level checks? wonder if we could also start using records but I must admit I've missed a lot of C# changes recently so not sure what should be struct vs class vs record vs record struct

Copy link
Member

@EliotJones EliotJones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this improve performance or is the benefit mainly code quality and compiler level checks? wonder if we could also start using records but I must admit I've missed a lot of C# changes recently so not sure what should be struct vs class vs record vs record struct

@BobLd
Copy link
Collaborator Author

BobLd commented Oct 18, 2023

@EliotJones it should improve performance slightly (related to defensive copy if I understand correctly, I would need to find back the article I found that was dicussing that), and it improves code quality for sure.

I agree on your point about record / record struct. I was planning to add a benchmark project at some point, this might be helpfull to assess what should be what

@BobLd BobLd merged commit c6e2de1 into master Oct 18, 2023
@BobLd BobLd deleted the readonly-struct branch October 18, 2023 22:44
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

Successfully merging this pull request may close these issues.

2 participants