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

  • Home
  • SEARCH
  • 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 8216449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:07:43+00:00 2026-06-07T12:07:43+00:00

at first I would like to try to explain my plan: Sometimes I just

  • 0

at first I would like to try to explain my plan: Sometimes I just have to change some static values in my code (lets say, the path to a folder with data my program needs or the url to upload something) and after that I have to compile again. If lets say the url is changed where I want to upload the files and the url is like I said static in my code – well I have to change it in Visual Studio and compile it again…and again and again. Well thats why I think this is NOT a good idea. It would be better to make a config file (a file where I can store all my values/information that I need) and read this file every time my program is starting. Now I could make changes without compiling – I just have to edit my config file.

I thought I choose the XML format, I could take an normal textfile, but I think an XML is more secure and easier to read if it gets complex. Now there is maybe one problem with this: I have to ‘hardcode’ the path to my XML file. I think I will never change the path to the config file, but what if I would? Then I have to change the path in my code again. Is there maybe a smarter solution for this?

The next step would be that I have to read the XML file on every startup. Now I would like to know what is the best OOP solution to get the information and use it? I thought I make a class (lets say Myconfig) and in this class I have only final variables (I think final is readonly in c#) with getter and setter. I will create a new Myconfig on every startup and I will parse the XML file – while Im parsing and getting the information Im using the setter to save the information in the class variable. After Im done I have an object with all the information and now I could send/use this object everywhere to get these information (let say with Myconfig.Url , Myconfig.Path …).

Well thats my plan 🙂 Im really new to this, Im sure this is not perfect. Any suggestions?

  • 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-06-07T12:07:46+00:00Added an answer on June 7, 2026 at 12:07 pm

    use a configuration file with the ConfigurationManager class to access values in it. .NET has already provided this solution for you – there is no reason for you to write one yourself.

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

Sidebar

Related Questions

This is my first question in StackOverflow, so I would try to explain my
I would like someone to try and explain the difference between these. More specifically,
I have legacy database and tables that I would like to try to import
First I would like to say that I am new to this site, never
Please take a look at this screenshot first: I would like to move the
I would first like to admit that I am an extremely novice developer, so
First off I would like to say that I think that my question may
First off I would like to say that this is my first post and
Right first of I would like to thank everyone for helping me out on
I'm using : log_file = AWS::S3::Bucket.logs_for('downloads.idance.net').first I would then like to delete each file

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.