Debate: Public Fields and Naming Conventions
public property string Name;
Also debated was the use of case (C# only) to distinguish properties from their corresponding private variables. The Microsoft Internal Coding Guidelines suggest:
- Do not use Hungarian notation
- Do not use a prefix for member variables (_, m_, s_, etc.). If you want to distinguish between local and member variables you should use “this.” in C# and “
” in VB.NET. Me.
- Do use camelCasing for member variables
- Do use camelCasing for parameters
- Do use camelCasing for local variables
- Do use PascalCasing for function, property, event, and class names
- Do prefix interfaces names with “I”
- Do not prefix enums, classes, or delegates with any letter
Finally, constants declared in SCREAMING_CAPS were renounced, though many posters noted that they find that constants created in this style stand out easily from variables that can be modified. The Microsoft guidelines do not specifically weigh in on the issue of constant declarations, but examples in the .NET framework include constants declared with Pascal casing.
Randy Shoup Jul 03, 2015