// XML 文件
<?xml version="1.0" encoding="utf-8" ?>
<JLVersion>
<version>
<Number>jl-11.0104</Number>
<Time>2011-01-04</Time>
</version>
</JLVersion>
//读取xml 返回list
public List<string> getVersion()
{
List<string> list = new List<string>();
XmlDocument xmldoc = new XmlDocument();
//获取物理路径
string path = Server.MapPath("/Version/version.xml");
//加载xml文档...
xmldoc.Load(path);
//第一个节点
XmlNode xmlnode = xmldoc.SelectSingleNode("JLVersion");
//遍历子节点
foreach (XmlNode node in xmlnode)
{
list.Add(node.ChildNodes[0].InnerText);
list.Add(node.ChildNodes[1].InnerText);
}
return list;
}
来源:https://www.cnblogs.com/syyblog/archive/2011/01/04/1925449.html