Total .NET Analyzer Rule Documentation  

Hungarian Rule

Hungarian notation is not a recommended naming convention in .NET.

Remarks

In the past, Microsoft suggested using Hungarian naming. Hungarian notation involved prefixing variable names with characters to denote variable type. For example, Boolean variables would be prefixed with 'b' ('bContinue'). Because previous versions of Visual Studio did not enjoy the benefits of .NET's strong typing and common type system, naming conventions such as Hungarian were important tools for writing understandable and maintainable code

For .NET, Microsoft has changed its naming conventions, and no longer recommends Hungarian notation. There are several reasons that Hungarian Notation is no longer recommended, including:
- .NET code is strongly typed, removing the need to identify variable type by its name.
- .NET has a rich new type system. Coming up with prefixes for all of the new types would tedious and hard to keep track of.
- In Visual Studio .NET, you simply have to hover over a variable to get its type. This removes the need to identify a variable's type by its name.
- Eliminating Hungarian Notation makes code easier to manage, especially when you decide that you need to change a variable's type (for example, if you decide to use a double instead of a long).

By default, Total .NET Analyzer does not identify controls that use Hungarian naming, but you can change this behavior through the Rule Editor.

Resolution

Microsoft suggests using a combination of Pascal Case and Camel Case styles. See the Capitalization Styles help information for more information on Microsoft's naming guidelines.

(Note that this is standardized naming convention, so it has no effect on the execution of code.)

See Also

Capitalization Styles

Total .NET Analyzer Pascal Case Rule

Total .NET Analyzer Camel Case Rule