/// <Summary> /// read XML content /// </Summary> /// <returns> </returns> Public String getvalue (string dataitem) {xmldocument xdoc = new xmldocument (); // obtain the path and name of the executable file xdoc. load ("config. XML "); xmlnode xnode; xmlelement xelem1; xnode = xdoc. selectsinglenode ("Settings"); xelem1 = (xmlelement) xnode. selectsinglenode (dataitem); If (xelem1! = NULL) return xelem1.innertext; else return "";} /// <summary> /// write the XML document /// </Summary> /// <Param name = "appkey"> </param> /// <Param name = "appvalue"> </param> Public void setvalue (string appkey, string appvalue) {xmldocument xdoc = new xmldocument (); // obtain the path and name of the executable file xdoc. load ("config. XML "); xmlnode xnode; xmlelement xelem1; xmlelement xelem2; xnode = xdoc. selectsinglenode ("Settings"); xelem1 = (Xmlelement) xnode. selectsinglenode (appkey); If (xelem1! = NULL) xelem1.innertext = appvalue; else {xelem2 = xdoc. createelement (appkey); xelem2.value = appvalue; xnode. appendchild (xelem2);} xdoc. save ("config. XML ");}