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.
For example, a property named HorizontalAlignment is more readable in English than AlignmentHorizontal.
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.
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#.
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.