如何存储此名称,将名称值映射到哈希表中 [英] How to store this name,mapped name values into hash table
本文介绍了如何存储此名称,将名称值映射到哈希表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
XmlDocument doc = new XmlDocument();
Dictionary<string,> dic= new Dictionary<string,>();
doc.Load(@"C:\Users\Sampledata.xml");
XmlNode root = doc.DocumentElement;
if (root.HasChildNodes)
{
XmlNodeList columnName = root.ChildNodes;
IEnumerator ienum = columnName.GetEnumerator();
while (ienum.MoveNext())
{
XmlNode result1 = (XmlNode)ienum.Current;
String name = result1.Attributes["Name"].Value;
String mappedName = result1.Attributes["MappedName"].Value;
String dataType = result1.Attributes["DataType"].Value;
// String length = result1.Attributes["Length"].Value;
dic.Add(name, mappedName);
}
}
推荐答案
Hashtable h = new Hashtable();
h.Add(hash.Keys, hash.Values);
这篇关于如何存储此名称,将名称值映射到哈希表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文