C # settings management

It seems to me that I always invent a wheel for each application when it needs to load / save the general settings to an xml file. What is the best way to manage the basic parameters of the application that the user can configure and need to save / restore?

+6
c # xml settings
source share
5 answers

I like the use of custom configuration sections in .config files in conjunction with Downloading external .config files instead of the standard app.config.

+7
source share

Are you using Visual Studio? There's a built-in settings manager, and I believe that it works well for most situations. Just remember to call Settings.Save() before the application closes.

+5
source share

Why do people recommend app.config or web.config? they are the ugliest files in the world. Try your own XML http://www.picnet.com.au/blogs/Guido/post/2009/09/10/XML-Settings-Files-No-more-webconfig.aspx

This design is easy to get used to, and once you do, you will never return to these ugly files again.

+2
source share

File / New Item ... and select "Settings." Then you can configure the user and application settings, and VS generates a class that gives you easy access to these settings.

0
source share

This is probably not the best method (for example, bc restarts the web application), but if you need something quick and dirty, for example, for a small application where you just need to access / change some simple values, take a look at

http://www.dotnetspark.com/Forum/656-how-to-modify-webconfig-file-dynamically.aspx (see Lalit answer)

http://ramanisandeep.wordpress.com/2009/04/07/programming-the-webconfig-file-using-c/

0
source share

All Articles