Bad "To const" suggestion on public class for public static readonly field

I think ReSharper should not suggest "To const" refactoring for public static readonly fields for public classes.

public classSomeClass
   public static readonly int SomeConstant = 1; // ReSharper suggest "To const"

Using public constants on public classes could lead some problems:

=== Assembly A ===
public class SomeClass
   public const int SomeConstant = 1;

=== Assembly B ===
void SomeMethod()
   var a = SomeClass.SomeConstant; // compiler uses _value_ of SomeConstant

when we deploy new version of assembly A (with changes: SomeConstant to 2, e.g.) and place it to the folder with assembly B without recompiling assembly B
we will still get value 1 in our SomeMethod

PS: Sorry if it is duplicate.


Please sign in to leave a comment.