Thursday, January 21, 2010

Constants and ReadOnly

Because of the restriction on constant types being knowable at compile time, const can’t be
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.

No comments: