开发者

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

开发者 https://www.devze.com 2022-12-28 09:30 出处:网络
How do you manage symbolic constants in your projects?Where do you declare solut开发者_StackOverflow社区ion scope constants ?It is pretty rare (for me at least) that there isn\'t an obvious relationsh

How do you manage symbolic constants in your projects? Where do you declare solut开发者_StackOverflow社区ion scope constants ?


It is pretty rare (for me at least) that there isn't an obvious relationship between such constants and some pre-existing class at the heart of the domain model - I'd just add them there. Then the constants are tightly scoped to the appropriate part of the model, rather than just being in a "Constants" class.

Of course, I also find it pretty rare to find true "constants"; many interesting "constants" are described better through configuration options.


We have a constants class where we put all the constants in. We declare it static and then make the constants static public, since there is no need to instantiate it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号