What is the capitalization conventions for protected field names in C#?
Is it _myVar (like private field) or MyVar (like properties)?
ccoding-standardsnet
What is the capitalization conventions for protected field names in C#?
Is it _myVar (like private field) or MyVar (like properties)?
Best Answer
There is something that is called Design Guidelines for Developing Class Libraries which is written by Microsoft.
It says the following:
As well as:
As for the
_
prefix, it's used just as often as thethis.
convention (as far I've seen browsing source code in CodePlex/GitHub). ReSharper, for instance, promotes_
in its naming checks.