Is this:
public MyClass
{
public const string SomeString = "SomeValue";
}
worse than this:
public MyClass
{
public static string SomeString { get{ return "SomeValue";}}
}
Both can be referenced the same way:
if (someString == MyClass.SomeString)
...
The second however, has the protection of being a property. But really how much better is this than a const?
I have learned over and over the perils of having public fields. So when I saw some code using these constants on public fields, I immediately set about refactoring them to properties. But halfway through, I got to wondering what benefit it was to have the static properties over the constants.
Any ideas?