Replies: 2 comments 6 replies
-
Is changing the default also an option here? Currently records are intentionally opinionated and for anything outside the default you'd need to write your own class. I think this can apply to primary constructors, if you want mutable fields, you could declare mutable fields. class C(int readonlyByDefault) {
private int mutable = readonlyByDefault; // plus, capturing readonlyByDefault in this case is already a warning
} |
Beta Was this translation helpful? Give feedback.
5 replies
-
I don't like the Analyzer solution. If that direction turned out to be the best choice, I'd at least like to have compiler warnings for assignments to primary constructor parameters. PS: Thanks for your effort to push this forward. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
https://github.com/dotnet/csharplang/blob/main/meetings/2024/LDM-2024-05-08.md
Agenda
readonly
for primary constructor parametersBeta Was this translation helpful? Give feedback.
All reactions