//输出1234 public void TestDictionary() { Dictionary<string, int> dic = new Dictionary<string, int>(); dic.Add("One", 1); dic.Add("Two", 2); dic.Add("Three", 3); dic.Add("Four", 4); foreach (var r in dic.Keys) { Response.Write(dic[r]); } } //输出2341 public void TestHashtable() { Hashtable ht = new Hashtable(); ht.Add("One", 1); ht.Add("Two", 2); ht.Add("Three", 3); ht.Add("Four", 4); foreach (var r in ht.Keys) { Response.Write(ht[r]); } }