I know nothing about Rust, but I have been working with .Net for the last decade or so.
c# is very welcoming to the concept of immutability - c#7 introduced readonly structs, for instance, c#9 introduced a couple of very interesting features regarding immutability - One is the concept of "record" (that finally made it into the language) and the other is init auto properties, meaning you no longer have to write explicit constructors to get immutable properties.
Also, C# supports local constants for a very long time now - and constant fields from day 1.
To sum up - c# supports immutability and that support gets better in each language version .
Also, the very concept of immutable variables is, IMHO, an oxymoron.
I mean, the meaning of the word "variable" in English is "subject to change"...
If you want something to be immutable, use the already provided readonly options.
Yes! I'm very interested in the "with" keyword in particular. The difference for me is what the default is, but you're right. There are good immutable options for C#
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I know nothing about Rust, but I have been working with .Net for the last decade or so.
c# is very welcoming to the concept of immutability - c#7 introduced readonly structs, for instance, c#9 introduced a couple of very interesting features regarding immutability - One is the concept of "record" (that finally made it into the language) and the other is
init
auto properties, meaning you no longer have to write explicit constructors to get immutable properties.Also, C# supports local constants for a very long time now - and constant fields from day 1.
To sum up - c# supports immutability and that support gets better in each language version .
Also, the very concept of immutable variables is, IMHO, an oxymoron.
I mean, the meaning of the word "variable" in English is "subject to change"...
If you want something to be immutable, use the already provided readonly options.
Yes! I'm very interested in the "with" keyword in particular. The difference for me is what the default is, but you're right. There are good immutable options for C#