Where do I put project wide constants?

  • Page Owner: Not Set
  • Last Reviewed: 2021-10-14

Every Project should have a GlobalConstants.cs, where do I place it?


Answer

Every Project should have their GlobalConstants.cs file as close to the root of the most inherited project. Try to avoid using multiple consts files as it complicates ordering and other attribute tools for Optimizely.

For example APTA has a Base Project that all projects inherit from. The constants then can be accessed by all children projects. Since the constants are often common types (e.g. string) we shouldn't have any problem with dependencies.