Naming Conventions

suggest change

Introduction

This topic outlines some basic naming conventions used when writing in the C# language. Like all conventions, they are not enforced by the compiler, but will ensure readability between developers.

For comprehensive .NET framework design guidelines, see docs.microsoft.com/dotnet/standard/design-guidelines.

Remarks

Choose easily readable identifier names

For example, a property named HorizontalAlignment is more readable in English than AlignmentHorizontal.

Favor readability over brevity

The property name CanScrollHorizontally is better than ScrollableX (an obscure reference to the X-axis).

Avoid using underscores, hyphens, or any other non-alphanumeric 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, e.g. string strName.

Also, avoid using identifiers that conflict with keywords already used within C#.

Abbreviations and acronyms

In general, you should not use abbreviations or acronyms; these make your names less readable. Similarly, it is difficult to know when it is safe to assume that an acronym is widely recognized.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents