C naming convention for enum and matching property
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Enum naming in C# affects readability, API stability, and serialization behavior more than many teams expect. Consistent naming for enum types and their matching properties helps avoid ambiguous state modeling. Good conventions also reduce migration risk when enums cross service boundaries.
Name Enum Types by Semantics
For single-choice state enums, use singular PascalCase names.
A singular type communicates that one value is active at a time. Plural naming here often causes confusion.
Name Enum Members Clearly
Member names should be concise and domain-oriented. Avoid repeating the enum type name inside each member.
Good style:
- '
OrderStatus.Pending' - '
OrderStatus.Shipped'
Avoid noisy style such as OrderStatusPending because call sites already include type context.
Match Property Names to Domain Language
Properties that store enum values should use domain nouns, not implementation labels.
If class has several status dimensions, use explicit property names such as PaymentStatus and ShipmentStatus.
Flags Enums Use Different Convention
For bitmask-style combinable values, use [Flags] and plural enum type names.
Plural naming is appropriate here because multiple values can coexist.
Stabilize Numeric Values for Contracts
If enums are persisted or sent over APIs, assign explicit numeric values.
Explicit numbering prevents accidental contract drift when members are reordered.
Serialization-Friendly Naming Strategy
When enums are serialized as strings, member names become part of external contract. Keep names stable and avoid unnecessary renames.
If rename is required, plan backward compatibility and client migration carefully.
Keep Display Labels Separate
Enum members should be code identifiers, not user-facing text. Map display labels outside enum definition.
This separation simplifies localization and UI wording changes.
Team Convention Checklist
A useful review checklist:
- Single-choice enums are singular and PascalCase.
- Flags enums are plural with
[Flags]. - Properties use domain names, not suffix-heavy labels.
- Persisted enums have explicit numeric values.
- UI labels are not embedded in enum identifiers.
Consistent conventions reduce codebase entropy over time.
When introducing new enums, include one example usage in unit tests or API examples so naming intent is visible in real call sites, not only in static style rules.
Common Pitfalls
- Using plural enum names for single-state values.
- Adding redundant
EnumorValuesuffixes everywhere. - Renaming serialized enum members without migration plan.
- Mixing display text concerns into enum identifiers.
- Omitting explicit numeric assignments for persisted contracts.
Summary
- Use singular enum names for single-choice states and plural for flags sets.
- Keep member names concise and domain-centered.
- Name matching properties by domain meaning.
- Stabilize numeric values when enums are part of persisted or public contracts.
- Separate UI labels from code identifiers for maintainable design.

