'Static readonly' vs. 'const'

前端 未结 18 2622
旧巷少年郎
旧巷少年郎 2020-11-22 04:07

I\'ve read around about const and static readonly fields. We have some classes which contain only constant values. They are used for various things

18条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 04:49

    One thing to note is const is restricted to primitive/value types (the exception being strings).

提交回复
热议问题