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:


Naming Conventions:
* Naming Conventions
* Enums

Table Of Contents
17 Regex
19 Arrays
21 Enum
22 Tuples
24 GUID
27 Looping
36 Casting
46 Methods
53 Naming Conventions
88 Events
92 Structs
104 Indexer
106 Stream
107 Timers
109 Threading
127 Caching
135 Pointers
147 C# Script