What are the differences between const and readonly ?

Sno
const
readonly
1 Can't be static. Can be instance level or static
2 evaluated at design time evaluated at run time
3
Initialized at declaration

Initialized at declaration and in constructor
4
must be of integral type or enumeration
In addition it can have complex types with new keyword and
enumerations are not allowed

0 comments:

Post a Comment