private readonly Dictionary<string,string>
datafeedCon
fig = new Dictionary<string,string>(); public string GetCon
fig(string itemName,string attributeName) { string key = itemName + "_" + attributeName; if (
datafeedCon
fig.ContainsKey(key)) { return
datafeedCon
fig[key]; } string con
figPath = AppDomain.CurrentDomain.BaseDirectory + "\\Product
datafeedCon
fig\\Product
datafeed.con
fig"; var xmlDocument = new XmlDocument(); xmlDocument.Load(con
figPath); XmlNode root = xmlDocument.SelectSingleNode("Product
datafeed"); if (root != null) { var selectSingleNode = root.SelectSingleNode(itemName); if (selectSingleNode != null) { if (selectSingleNode.Attributes != null) { XmlAttribute item = selectSingleNode.Attributes[attributeName]; if (item != null) {
datafeedCon
fig.Add(key,item.Value); return item.Value; } throw new ApplicationException("未在" + con
figPath + "找到指定的配置项"); } } } throw new ApplicationException(con
figPath + "配置
错误"); }