Wednesday, September 9, 2009

What is the difference between CONST and READONLY?

The readonly keyword is different from the const keyword. A const field can only be initialized at the declaration of the field. A readonly field can be initialized either at the declaration or in a constructor. Therefore, readonly fields can have different values depending on the constructor used. Also, while a const field is a compile-time constant.

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home