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 7666135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:45:31+00:00 2026-05-31T14:45:31+00:00

I have some settings that I’d like to store in an external file of

  • 0

I have some settings that I’d like to store in an external file of some sort, so that someone can change the settings without having to recompile the application:

Server: test
Username: abc
Password: 123

Server: dev
Username: abc
Password: def

Server: live
Username: g5g5g5
Password :a4a4a4

I know I can put them in app.config under <appSettings>, but the problem with that is that the data needs to be ‘grouped’ together and <appSettings> only supports plain key/value pairs.

I could put it into an external file as JSON, but that would involve either writing a JSON parser or downloading one, which is not very desirable for this application’s use case.

What other methods are there to store this information? Preferably using whatever is built into the .NET framework already and is easy to implement and understand for new developers.

  • 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-31T14:45:32+00:00Added an answer on May 31, 2026 at 2:45 pm

    You can create a class with your custom settings

    e.g.

    public class MySetting
    {
        public string Server { get; set; }
        public string Username { get; set; }
        public string Password { get; set; }
    }
    
    public class MySettings
    {
        public List<MySetting> Settings { get; set; }
    }
    

    and save/load them to a file using the BinarySerializer, XmlSerializer, DataContractSerializer, or another serializer of your choice.

    Since you want to edit with a text editor, DataContractSerialzier would be a good choice.

    Here’s an example from MSDN showing how to serialize to a file

    http://msdn.microsoft.com/en-us/library/bb675198.aspx

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

Sidebar

Related Questions

I have some application settings that I'd like to add to my configuration file,
I'd like to have some settings that I can access from anywhere in my
I have created an application that uses settings.settings to store some user specific settings
I have a preference screen where I can change some settings. In the code
I have some stuff in settings.py that I'd like to be able to access
I have some settings in a web.config file that I want to override when
I have one array that contains some settings that looks like basically like this:
Most apps have some kind of preferences or user settings that can be stored
So I have some settings that are of the user scope, but for some
I have a string ($c) that contains a comma-separated list of settings. Some settings

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.