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)
參數無效