Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 869773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:21:52+00:00 2026-05-15T10:21:52+00:00

In almost every project, I can’t decide on how to deal with certain global

  • 0

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:

  1. 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.

  2. 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.

  3. 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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T10:21:53+00:00Added an answer on May 15, 2026 at 10:21 am

    If you want the values to be capable of being changed at runtime, use app.config.

    If you want them to be fixed at runtime then you’re going to have to (and want to, to stop users messing around with them) recompile every time you want to change them, so use whatever’s appropriate for your language. In the case of C#, some kind of GlobalValues class/assembly.

    Don’t use a resource file for global values or settings unless you want to swap sets of values in and out as a group (e.g. when compiling for a different language).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Duplicate post, see: When do you use the "this" keyword? On almost every project
Almost every new Java-web-project is using a modern MVC-framework such as Struts or Spring
Almost 5 years ago Joel Spolsky wrote this article, The Absolute Minimum Every Software
Almost every Java book I read talks about using the interface as a way
Almost every Python web framework has a simple server that runs a wsgi application
I don't edit CSS very often, and almost every time I need to go
Alright, after doing a ton of research and trying almost every managed CPP Redist
Im including almost every page in page_protect(); . I have made an variable for
( Almost exact duplicate of Keeping original format POST passing through AWK submitted by
In almost all projects, the choice of the database system is 'almost' automatic ..

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.