#531 – Best Practices for Naming Namespaces

In C#, a namespace declaration specifies the name of the namespace and you can use any valid C# identifier as the name.  However, it’s generally considered good practice to follow the suggestions listed below when naming namespaces.

  • Use Pascal Casing for each portion of the namespace, capitalizing the first letter of each word.  E.g. Acme.AfricanAnimalLibrary
  • Do not use underscores
  • Use sub-namespaces to organize/group related namespaces
  • The highest two levels of namespaces should follow the pattern CompanyName.ProductName or CompanyName.TechnologyName.  E.g. Acme.SearchEngine.Logging or Acme.Rendering.3DTools

Incorporating your company or organization name into the namespace hierarchy helps ensure that your types are globally unique.