C #: How do you manage symbolic constants in your projects? Where do you declare solution scope constants?

How do you manage symbolic constants in your projects? Where do you declare solution scope constants?

+2


a source to share


2 answers


We have a class of constants in which we put all constants in. We declare it static and then make it persistent since there is no need to create it.



+4


a source


It's quite rare (at least for me) that there is no explicit relationship between such constants and some pre-existing class, I would just add them there. The constants are then hard-coded to the relevant part of the model, rather than just being assigned to the "Constants" class.



Of course, I also very rarely manage to find true "constants"; many interesting "constants" are better described using configuration options.

+4


a source