A quick synopsis on the differences between 'const' and 'readonly' in C#:
'const':
- Can't be static.
- Value is evaluated at compile time.
- Initiailized at declaration only.
'readonly':
- Can be either instance-level or static.
- Value is evaluated at run time.
- Can be initialized in declaration or by code in the constructor.
Monday, December 22, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment