ReadOnly applies to properties. If you have a readonly property, the consumers of the class that contains the property can only read that property. The class could internally modify the value that is exposed by the property. Therefore, the value is readonly, but not constant.
If you want a "readonly" variable in a function, then you have to use "const".
|