|
xml文件写:
- public void WriteXml(string xmlPath, string AlgParam, double AlgParamValue)
- {
- try
- {
- XElement xRoot = XElement.Load(xmlPath);
- IEnumerable<XElement> xAlgorithms = xRoot.Elements("Algorithm");
- foreach (XElement xn in xAlgorithms)
- {
- XElement xmlParams = xn.Element("Params");
- foreach (var item in xmlParams.Elements("Item"))
- {
- if (item.FirstAttribute.Value.ToString() == AlgParam)
- {
- item.LastAttribute.Value = Convert.ToString(AlgParamValue);
- }
- }
- }
- xRoot.Save(xmlPath);
- }
- catch (Exception ex)
- {
- }
- }
复制代码
|
|