Skip to content

Readonly parameters in primary contructor #7699

Discussion options

You must be logged in to vote

You and about 100,000 other devs want this feature. The last we heard from the team on this is documented in C# Language Design Meeting for July 31st, 2023:

... Primary constructor parameters will ship as mutable-by-default, and we will investigate the readonly parameter modifier shortly...

Worryingly, in #7667, MS were still asking the question, "What else would you like to see and what are the important scenarios to you? ... Support for immutability in primary constructor parameters?" just last week. Whether that implies that either we haven't arrived at that "shortly" period of time yet, or the team are backtracking on ever doing this is unclear at the moment.

Replies: 3 comments 5 replies

Comment options

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

@CyrusNajmabadi
Comment options

Answer selected by Krzysztof318
Comment options

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

@Krzysztof318
Comment options

Comment options

You must be logged in to vote
1 reply
@ufcpp
Comment options

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