Question: I was often wondering about the right way to do this:

For example, in my program I have around 100 constants (or enums) that are used in some calculation. They should preferrably be stored in one place. They can be grouped hierarchically, for example:

```
System3 / Rules / Rule7 / ParameterXY / MaxAverageValue

```

Naturally, I want those values to be accessible while coding, so storing them in some kind of ressource is not really an option.

As far as I could tell, this can be done with:

* very long constant names
* nesting classes
* namespaces

Using names is quite ugly, and it's not really well maintainable. I find nesting classes a nice way to do it, but some stylecop/fxcop rules forbid that, so this must be "bad" in some way. Lastly, I find the suggested alternative, using namespaces, not terribly nice neither. Imho it creates masses of folders and files that each contain almost nothing. And I don't like when 50 sub-namespaces pop up in the assembly reflector.

So.. how do you do this kind of task? What would you suggest?

Answer: 
How often is each constant re-used in multiple methods? You could consider reorganizing your constants. If you still find yourself with huge numbers of constants, try putting them in a static class with read-only properties.

If you just need a good place to look at them all in one place, you could also look at storing them in the app.config file and you can access them through AppSettings and the ConfigurationManager class.
We use Resources files with a custom T4 template that generates a static class hierarchy with readonly string fields for the values.

The keys in our Resource file are separated with '.' to build the hierarchy.

We can have separate resource files that are compiled into one class hierarchy.

I know that nested classes is not recommended but in my opinion, for a situation like this it is the nicest solution.