Search code examples
coding-style

How do I find a list of Hungarian notation prefixes?


I know that there are so many standards for writing code. And some policy tools (like FxCop) to check your writing statements.

What's the best Hungarian notation or any other snippets for writing code?

Like:

  • lbl in start of naming a Label

  • txt in start of naming a TextBox

, etc.


Based on the answers, is it a good Idea to use Hungarian notation or not?


Solution

  • The Microsoft Framework Design Guidelines, under General Naming Conventions says:

    Word Choice

    Do choose easily readable identifier names. For example, a property named HorizontalAlignment is more readable in English than AlignmentHorizontal.

    Do favor readability over brevity. The property name CanScrollHorizontally is better than ScrollableX (an obscure reference to the X-axis).

    Do not use underscores, hyphens, or any other nonalphanumeric characters.

    Do not use Hungarian notation.

    Hungarian notation is the practice of including a prefix in identifiers to encode some metadata about the parameter, such as the data type of the identifier.