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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:13:17+00:00 2026-05-14T05:13:17+00:00

Could someone tell me the advantages to using the ConfigurationManager class which load’s a

  • 0

Could someone tell me the advantages to using the ConfigurationManager class which load’s a config file for manipulation VS an XML file with a class you build to read it yourself?

Recently, I built a class which inherits from ConfigurationSection in order to manipulate a custom section within app.config. This was quite a bit of work compared to just opening and reading an XML file.

Some people chose the first approach, others chose the second.

What’s good practice?

  • 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-14T05:13:17+00:00Added an answer on May 14, 2026 at 5:13 am

    This is an old question, but what the hell… so yes, there is quite some code overhead in writing configuration sections and elements, but what you get as compared to using your own class with an XML serializer include:

    • Type conversions and validations: if one of your configuration settings is, say, a “Type” (maybe you store in your configuration what kind of implementation you need to create for some provider), then the ConfigurationManager will not only convert whatever was written in the .config file to a System.Type, but you can also add validation attribtues on your ConfigurationElement’s property, like “SubclassTypeValidatorAttribute”, which will check that the given type derives from your base provider class/interface. You can of course add your own validators, so that in the rest of your code, you just “get” the configuration and you know everything’s valid.
    • Multi-level settings hierarchy: you can play around with storing settings at the machine, application or user levels, which gives you a mechanism to handle default vs. user-specific settings. You also have APIs to load configurations from custom locations.
    • No duplication in config files: if you’re using other .NET features like TraceSources and stuff, the configuration for that is already in the .config file (say you’re troubleshooting a problem and you want to turn on some debug trace that’s off by default… you do that by just modifying the .config). If you’re using your own config file for your custom settings, then you end up with 2 configuration files, which is not so good.

    There’s probably other benefits, but that’s what comes to mind so far.

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

Sidebar

Related Questions

Could someone please tell me which objects types can be tested using Regular Expressions
Could someone tell me how to view the XML to be sent via web
Could someone tell me if the code below would achieve what I want, which
Could someone tell me why this is happening, please? My XML is: <?xml version=1.0
Could someone tell me which version of MySql is required to use Doctrine2 ?
Could someone tell me which gets called first, is it onActivityResult() or is it
Could someone tell me if the location of the script tag matters while using
I want to create a class using reflection for a generic class. Could someone
Could someone tell what to do when you have a method like this: class
Could someone tell me what the units the SetTimeout(int) method in the ICriteria interface

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.