1
名单解析与多个值比较词典<字符串,列表<string>>单值与值的C#
Dictionary<string, List<string>> dictionary = new Dictionary<string, List<string>>();
doc.Load(confidencethresholdFilePath + "\\input.xml");
// XmlNodeList nodes = doc.DocumentElement.SelectNodes("/root/file");
doc.Normalize();
XmlNodeList nList = doc.GetElementsByTagName("key");
for (int temp = 0; temp < nList.Count; temp++)
{
string keyvalue = "";
XmlNode nNode = nList.Item(temp);
List<String> main = new List<string>();
ArrayList arrayList = new ArrayList(main);
XmlElement ele = (XmlElement)nNode;
keyvalue = ele.GetAttribute("value");
for (int i = 0; i < ele.ChildNodes.Count; i++)
{
if (ele.ChildNodes[i].ChildNodes.Count == 1)
{
Double sec = Double.Parse(ele.ChildNodes[i].InnerText);
int seg = TimeToSegment(sec);
Console.WriteLine("" + seg);
main.Add(Convert.ToString(seg));
}
}
dictionary.Add(keyvalue, main);
}
我想与单个值comapare但同样关键的XML和形式字典它显示错误 dictionary.ContainsValue(s.sname)
参数无效