public static string GetValue(string AppKey)
{
//实例化xml解析器对象
System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument();
//加载文档
xDoc.Load(System.Windows.Forms.Application.StartupPath + "/user.config");
//xml文档中的单个字节
System.Xml.XmlNode xNode;
//元素
System.Xml.XmlElement xElem1;
//选择configuration第一个字节
xNode = xDoc.SelectSingleNode("//configuration");
xElem1 = (System.Xml.XmlElement)xNode.SelectSingleNode("//add[@key='" + AppKey + "']");
if (xElem1 != null)
{
//获取指定名称特新的值
return xElem1.GetAttribute("value");
}
else
{
return "";
}
}