Because of the restriction on constant types being knowable at compile time, const can’t be
used in many situations.
used in many situations.
The readonly modifier is designed for exactly that situation. By applying readonly, you can
set the value in the constructor or in an initializer, but you can’t modify it later.
set the value in the constructor or in an initializer, but you can’t modify it later.
No comments:
Post a Comment