config - Best practice to create a .NET configuration file editor application? -


i've develop small wpf (.net fwk 4.5) app allow user edit appsettings section of 5 files differents .config file.

these 5 files application configuration file of 4 console applications , 1 wpf composite application.

in each file, appsettings hold smtp/pop3 server addresses, configuration , other misc. information.

my question : best microsoft best practices available create kind of app?

is there way downsize/factorize 5 files single 1 or @ least create xml formatted file holding common appsetting 5 app configure?

thanks reply,

ok, i've found myself : factorize using file attribute of appsettings element; here i've done :

<appsettings file="..\appsettings.config"></appsettings> 

use xpath query , xmldocument class of .net framework :

xmldocument myxmldocument = new xmldocument(); myxmldocument.load('appsettings.config'); xmlnode root = myxmldocument.selectsinglenode("/appsettings"); string attributename = "smtpserver"; xmlnode node = root.selectsinglenode("/appsettings/add[@key='" + attributename + "']"); //read value of 'value attribute' of node var myvalue = node.attributes["value"].value;  myxmldocument.save("appsettings.config"); 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -