Skip to content

Naming conventions for private constants #46866

Description

@musjj

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.


Associated WorkItem - 595626

Metadata

Metadata

Assignees

Labels

📌 seQUESTeredIdentifies that an issue has been imported into Quest.

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
🔖 Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions