Microsoft says fields and properties must differ by more than just case. So, if they truly represent the same idea how should they be different?
Here’s Microsoft’s example of what not to do:
using System;
namespace NamingLibrary
{
public class Foo // IdentifiersShouldDifferByMoreThanCase
{
protected string bar;
public string Bar
{
get { return bar; }
}
}
}
They give no guidance on how this should look. What do most developers do?
No, Microsoft says publicly visible members must differ by more than just case:
(That includes protected members, as they’re visible to derived classes.)
So this is fine:
My personal rule is not to allow anything other private fields anyway, at which point it’s not a problem.
Do you really need protected fields? How about making the property have a protected setter if you want to be able to mutate it from derived classes?