Skip to content
Discussion options

You must be logged in to vote

Is it intended or it's a design fault?

Very intentional. The issue with mutability in reference types is unintentional mutation far from where you are creating an using the record, which can cause many fun issues (such as losing a key in a dictionary). Value types are copied by value, not by reference, so any mutations you make only affect your copy of the data, not anyone else's. Passing a value type by ref is a conscious and visible choice in the code, so mutations from that are obvious and obviously intended.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by melanchall
Comment options

You must be logged in to vote
2 replies
@melanchall
Comment options

@CyrusNajmabadi
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants