Why does ReSharper prefer consts over readonly?

Viewed 1291

I've noticed ReSharper suggestion under "Common Practices and Code Improvements": Convert local variable or field to constant.

I've also noticed that in Bill Wagner's book "Effective C#: 50 Specific Ways to Improve Your C#", there is a language idiom "Prefer readonly to const" in which the author explains the risks of using consts.

My question is not about the differences between readonly and const and when to use them, but why one source put const as a common practice/code improvement, and on the other hand, the second one treats readonly as an idiom?

3 Answers

Probably because of this:

The expression being assigned to a must be constant

You can always assign constants to readonly fields. However it doesn't seem to be possible to assign readonly to const.

Related