俺用以下代码得到一个IDictionary rootMap, 然后用foreach (DictionaryEntry myDE in rootMap) 读value和key,但无论怎么样都只得到rootMap里的内容,得不到itemMap里的,怎么样才能把IDictionary rootMap里的全部内容,包括itemMap的也读出来呢?谢谢IDictionary rootMap = new Hashtable();
IList items = new ArrayList();
IDictionary itemMap = null;
rootMap.Add("items", items);
rootMap = new Hashtable();
items.Add(rootMap);itemMap.Add("title", "itemTitle");
itemMap.Add("link", "itemLink");
itemMap.Add("description", "itemDescription");rootMap.Add("title", "rootTitle");
rootMap.Add("description", "rootDescription");
rootMap.Add("link", "rootLink");
IList items = new ArrayList();
IDictionary itemMap = null;
rootMap.Add("items", items);
rootMap = new Hashtable();
items.Add(rootMap);itemMap.Add("title", "itemTitle");
itemMap.Add("link", "itemLink");
itemMap.Add("description", "itemDescription");rootMap.Add("title", "rootTitle");
rootMap.Add("description", "rootDescription");
rootMap.Add("link", "rootLink");
IDictionary rootMap = new Hashtable();
IDictionary itemMap = new Hashtable();
C#
foreach (DictionaryEntry de in myHashtable) {...}quote: http://msdn2.microsoft.com/en-us/library/system.collections.idictionary.aspx