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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:32:04+00:00 2026-05-25T19:32:04+00:00

Reed Copsey gave this response to the following SO Question: Which design patterns can

  • 0

Reed Copsey gave this response to the following SO Question:

Which design patterns can be applied to the configuration settings problem?

I prefer to create an interface for setting query, loading, and
saving. By using dependency injection, I can inject this into each
component that requires it.

Can someone give a code example of this? For instance a Settings class for an Email Client and another Settings class for a FTP Client based on this "interface" that can be DI. I understand that you can do a global singleton for all settings within the application (which I am currently doing) but this recommendations from Reed is interesting and would like to try it out.

  • 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-25T19:32:05+00:00Added an answer on May 25, 2026 at 7:32 pm

    For the interface, I would do something like this:

    public interface ISettingsProvider
    {
        void Load();
    
        T Query<T>(string key);
        void Set<T>(string key, T value);
    
        void Save();
    }
    

    Then I would implement that interface once and dependency inject it with let’s say MEF. I guess I’d implement it with LinqToXml to load/save to XML and maybe have a Dictionary to cache the settings in memory. Another way would be to binary serialize your objects and dump a snapshot somewhere (which has it’s downsides, e.g. it is not human-readable).

    If you only save strings and/or numbers, XML is a good choice. If you only have strings, you can even ditch the generics.

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

Sidebar

Related Questions

I recently started this question in another thread (to which Reed Copsey graciously responded)
I've got a sequence of 28 bytes, which are supposedly encoded with a Reed-Solomon
Next question about russian encoding, mssql and python. I have this simple code: import
It was suggested in this question , that I could cast a generic collection
Update : It occurred to me after posting this question that the main downside
I'm interested in using a Reed-Solomon error correction [ http://en.wikipedia.org/wiki/Reed%E2%80%93Solomon_error_correction as a reference] to
Does anybody have any reference material that details Cauchy-Reed algorithm? Googling for Cauchy-Reed Solomon
While the question check if input is type of string has been closed two
I Just started looking at this technology , but i am finding it hard
Given this example : // Create an arary of car objects. car[] arrayOfCars= new

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.