Skip to content

readonly struct Should not contain reference type #75249

Closed Answered by CyrusNajmabadi
MohamadAlallan-Pi asked this question in Ideas
Discussion options

You must be logged in to vote

Read-only structs are not immutable, they are read-only. This has been the design of read-only in the language since 1.0. Changing this would break the world.

If you want to have this restriction in your own code, you can write an analyzer for that purpose.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by CyrusNajmabadi
# for free to join this conversation on GitHub. Already have an account? # to comment
Category
Ideas
Labels
None yet
2 participants