O'Reilly logo
  • Zachary Kreft thinks this is interesting:

Updating the value of a public constant should be viewed as an interface change. You must recompile all code that references that constant


Cover of Effective C# (Covers C# 4.0): 50 Specific Ways to Improve Your C#, Second Edition


Instances to a constant will be replaced with the value it represents in the IL, rather than a reference to it. Therefore, other code which references a constant within the current file will not be automatically updated without being explicitly recompiled.

The readonly modifier solves this problem by not replacing it with a value. Therefore, its value will be correct even if the other code isn't recompiled. Although slightly less efficient, this solves a problem that could be hard to nail down.