These rules come from Microsoft's C# identifier naming rules and conventions, which follow the style of the .NET runtime team. The compiler doesn't enforce them, but code analysis rules can.

The naming table

IdentifierConventionExample
Classes, structs, records, enums, delegatesPascalCaseWorkerQueue
InterfacesPascalCase with an I prefixIWorkerQueue
NamespacesPascalCaseContoso.Billing
Methods, properties, eventsPascalCaseStartEventProcessing()
Public fieldsPascalCaseIsValid
Constants (all, including private)PascalCaseMaxRetries
Parameters and local variablescamelCaseworkerQueue
Private and internal fieldscamelCase with __workerQueue
Private and internal static fieldss_ prefixs_workerQueue
Thread-static fieldst_ prefixt_timeSpan
Generic type parametersT, or descriptive with a T prefixTSession
Attribute typesAttribute suffixObsoleteAttribute

Constants are PascalCase, not ALL_CAPS

This catches people coming from Java, C or Python. Microsoft says to use PascalCase for constant names, both fields and local constants, including private and internal ones. Write const int MaxRetries = 3;, not MAX_RETRIES.

Records and primary constructors

Positional record parameters are PascalCase, because they become the record's public properties: record Person(string FirstName, string LastName);. Primary constructor parameters on ordinary classes and structs are camelCase, like any other parameter.

Other rules worth knowing

  • Enums: use a singular noun for an ordinary enum and a plural noun for a [Flags] enum.
  • Prefer clarity over brevity, and avoid single-letter names except for simple loop counters.
  • Avoid abbreviations and acronyms unless they're widely known.
  • Don't use two consecutive underscores in an identifier; those names are reserved for the compiler.

Microsoft's page doesn't give a rule for how to case a two-letter acronym, so check what your codebase or analyzer settings already do.

Converting names with Transform Case

Our snake_case, camelCase, PascalCase and CONSTANT_CASE converters treat an acronym as one word, so HTTP server error becomes HttpServerError and http_server_error. That matches Microsoft's examples for most names. Add the I, _, s_ or t_ prefix yourself where the table calls for one.

Naming conventions in other languages: Python, Java, Go (Golang), Rust, Kotlin, Swift, Dart, PHP. All side by side: 20 languages compared.

Sources

Questions

Should C# constants be ALL_CAPS?
No. Microsoft's conventions use PascalCase for all constants, including private and internal ones: MaxRetries.

How do you name private fields in C#?
camelCase with a leading underscore, such as _workerQueue. Private static fields use s_ and thread-static fields use t_.

Do C# interfaces start with I?
Yes. Interface names start with a capital I, as in IWorkerQueue.