Why does C# disallow readonly local variables? [closed]

I think it’s a poor judgement on part of C# architects. readonly modifier on local variables helps maintain program correctness (just like asserts) and can potentially help the compiler optimize code (at least in the case of other languages). The fact that it’s disallowed in C# right now, is another argument that some of the “features” of C# are merely an enforcement of personal coding style of its creators.

Leave a Comment