Open
Description
Describe the issue or suggestion
Identifier names - rules and conventions page specifies that:
- Use PascalCase for constant names, both fields and local constants.
- Private instance fields start with an underscore (_) and the remaining text is camelCased.
And the .NET Runtime team's coding style also specifies that:
We use
_camelCase
for internal and private fields
We use PascalCasing to name all our constant local variables and fields.
But it doesn't clarify whether private constants should be _camelCase
or PascalCase
.
The const keyword page implies that it should always be PascalCase
. But it also illustrates some odd naming conventions, such as public fields called x
and y
(shouldn't it be X
and Y
?).
I think an explicit clarification would be helpful here.
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
- ID: a2d591be-290e-62d1-e99a-a7d26af20ef8
- Version Independent ID: 7f85babc-6295-21dd-f194-dede663f9966
- Platform ID: e381d97b-6429-3fb1-4154-d3c8da3bf2bb
- Content: Identifier names - rules and conventions - C#
- Content Source: docs/csharp/fundamentals/coding-style/identifier-names.md
- Service: dotnet-csharp
- Sub-service: fundamentals
- GitHub Login: @BillWagner
- Microsoft Alias: wiwagn