Correct way to read configuration file and using configuration values

Posted by Harza on Stack Overflow See other posts from Stack Overflow or by Harza
Published on 2012-09-05T09:36:12Z Indexed on 2012/09/05 9:37 UTC
Read the original article Hit count: 217

Filed under:
|

I'm reading applications .config file using .NET ConfigurationManager like it should be done, but ....

Which one is most preferred option:

  1. Read config and store instance of (build in or custom) ConfigurationElement for later use
  2. Read config and store only needed values (but not instances of ConfigrationElement classes) for later use
  3. Read ConfigurationElement from config always when configuration values are needed

These two things are in my mind:

  • Performance impact in case 3 when reading config all the time
  • Problems occuring in case 1 when using cached instances of ConfigurationElements

© Stack Overflow or respective owner

Related posts about c#

Related posts about configurationmanager