标签:des io ar for 文件 sp art on c
public static string AppConfig()
{
return System.IO.Path.Combine(Application.StartupPath, "BlackBoxForms.exe.config");
}
/// <summary>
/// 根据Key获取Value值
/// </summary>
/// <param name="appKey">Key</param>
/// <returns>Value值</returns>
public static string GetValueByKey(string appKey)
{
try
{
string xmlValue = "";
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(AppConfig());
XmlNode xNode = xmlDoc.SelectSingleNode("//appSettings");
foreach (XmlNode node in xNode.ChildNodes)
{
if (node.Attributes["key"].Value == appKey)
{
xmlValue = node.Attributes["value"].Value;
}
}
return xmlValue;
}
catch (Exception ex)
{
return ex.Message;
}
}
标签:des io ar for 文件 sp art on c
原文地址:http://www.cnblogs.com/liuhuanping/p/3997415.html