In C# you can use the readonly modifier for a class level field to indicate (to comipler and other DEVS) that once set it cannot be changed.I'd quite like for the ability to mark a variable declared in a method to be readonly, so once set it cannot be changed.Is there a way to do this? If not would be a good feature of C# or does it indicate that I my code is poorly constructed if I am wanting it?Example:public void DoSomthingGreat(string username) {    readonly bool isAdmin = GetTheIsAdminStateforUser(username);    // do some stuff    // now ask if the user is admin before doing something else,    // knowing that the flag shouldn't have been changed by another DEV!    if (isAdmin)    {        // Do some other stuff that only admins can do    }}
Would it be good to have a readonly modifier for method level variables?
language design