C# – Configuration file that can be modified by user in C#

cconfiguration

I want to create a configuration file (text file preferred) that can be modified by user. A windows service will read from that file and behave accordingly. Can you recommend a file format for this kind of process?
What I have in my is a config file like the game config files, but could not imagine how to read from it.

My question is very similar to INI files or Registry or personal files?, but my question is different because I need to consider user editing.

Best Answer

Personally I'd use Settings, its xml based, but the real benefit is that MS have already done all the coding for you for most types (including both global settings and per user overrides), so it really simple to use. as Wyatt points out in his answer it is also possible to extend using custom configuration sections (personally I find this overkill for most configuration needs, but its nice to have available when you do have a complex configuration scenario).

Depending on how tech savvy the users are you could use Settings and allow the user to edit the xml themselves.

If the users are not tech savvy then I'd suggest you provide a GUI to allow editing anyway as otherwise you will quickly find you have support calls about corrupt config files (regardless of what format you use)