Y
Hacker News
new
|
ask
|
show
|
jobs
by
stonemetal12
594 days ago
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.
1 comments
contextfree
594 days ago
More precisely in C# a readonly field of a type can only be assigned to within that type's constructor.
link
skrebbel
594 days ago
Which means you can't have a partially instantiated object except while the constructor is running.
link