logoalt Hacker News

stonemetal1211/08/20241 replyview on HN

Both Java and C# do. In Java marking a variable final makes it immutable after assigned. In C# a variable marked readonly is the same.


Replies

contextfree11/08/2024

More precisely in C# a readonly field of a type can only be assigned to within that type's constructor.

show 1 reply