Note: This example is only in the code in order to read a fixed number of values, write a bit dead, so when you use the other to modify or expand their own
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Xml;namespacemytool{ Public classGetconfigvalue {/// <summary> ///reads the application column current configuration file, specifying the value of the node/// </summary> /// <param name= "AppKey" ></param> /// <returns></returns> Public Static stringGet_configvalue (stringConfigfilename,stringAppKey) { Try{System.Xml.XmlDocument XDoc=NewSystem.Xml.XmlDocument (); Xdoc.load (System.Windows.Forms.Application.StartupPath+"\\"+configfilename); System.Xml.XmlNode XNode; System.Xml.XmlElement xElem1; XNode= Xdoc.selectsinglenode ("//appsettings"); XElem1= (XmlElement) Xnode.selectsinglenode ("//add[@key = '"+ AppKey +"']"); //xElem1 = (XmlElement) xnode.selectsinglenode ("//add key= ' "+ AppKey +" ' "); if(XElem1! =NULL) { stringval = Xelem1.getattribute ("value"); returnVal; } Else { return ""; } } Catch//(Exception ex) { return ""; } } }}