Monday, March 26, 2012

C#'s const vs. readonly

A quick synopsis on the differences between 'const' and 'readonly' in C#:
Can't be static.
Value is evaluated at compile time.
Initiailized at declaration only.

Can be either instance-level or static.
Value is evaluated at run time.
Can be initialized in declaration or by code in the constructor.

1 comment:

  1. This comment has been removed by a blog administrator.