Why does C# disallow readonly local variables?

后端 未结 13 1176
萌比男神i
萌比男神i 2020-11-27 17:17

Having a friendly debate with a co-worker about this. We have some thoughts about this, but wondering what the SO crowd thinks about this?

13条回答
  •  攒了一身酷
    2020-11-27 18:05

    It is an oversight for c# language designer. F# has val keyword and it is based on CLR. There is no reason C# can't have the same language feature.

提交回复
热议问题