KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In almost every project, I can't decide on how to deal with certain global constant values. In the older days, when I wrote C++ programs which didn't used dll's, it was easy. Just create and .h file with a number of const that described certain constant values for my project. Then I had every file include it, and ta-da! It worked. Clean, respected the DRY principle and was simple. Now my projects are C# .Net, which gives me a large range of options to deal with this problem. From what I know: Create an Assembly whose only purpose is to hold constant values for my project. Every other Assembly should then reference this one . I respect DRY and KISS, since adding references is simple enough. Main problem here is that I'd need to recompile the whole source to update those values. Use a app.config file and have all other Assemblies retrieve the constant during initialization. So I add the overhead of having to initialize everything just to access a global value. Is more flexible but also more painful. Use resources. I think it's the same as with app.config. So, I know there's a better way to do this constants declaration. But I don't know and, so far, have been unable to find how to do it. Can you please help? I have candy! Thanks all
Tags (comma-separated)
Save Edits
Cancel