<!--
title: Consistent Identifier Naming
domain: cloud-infra
topic: Naming Conventions
language: C#
source: Azure/azure-powershell
updated: 2026-07-13
url: https://awesomereviewers.com/reviewers/azure-powershell-consistent-identifier-naming/
-->

Use naming rules that keep identifiers consistent, unambiguous, and resilient to change:

- Centralize repeated string keys/labels used as identifiers (e.g., dictionary/property-bag keys) into named constants so the same literal can’t drift across methods.
  - Prefer: `private const string VmSubscriptionIdKey = "VM Subscription ID";`
  - Then use `PropertyBag.ContainsKey(VmSubscriptionIdKey)` and `PropertyBag[VmSubscriptionIdKey]`.

- Follow established naming conventions for public API surfaces (cmdlet parameters, properties), including singularity guidance.
  - If a parameter represents a single logical item, name it in singular form (e.g., `Tag`), even if the underlying type is a map/hashtable.

Example (combining both practices):
```csharp
private const string VmSubscriptionIdKey = "VM Subscription ID";

// ...
if (vmJob.ExtendedInfo.PropertyBag.ContainsKey(VmSubscriptionIdKey))
{
    detailedResponse.Properties.Add(
        VmSubscriptionIdKey,
        vmJob.ExtendedInfo.PropertyBag[VmSubscriptionIdKey]);
}

[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true)]
[Alias("Tag")]
public Hashtable Tag { get; set; }
```
