Hashtable和Dictionary<T,K>的内部排序算法不一样,请看代码
Dictionary<string,string> ht=new Dictionary<string, string>();
ht.Add("http://www.sina.com.cn","");
ht.Add("http://www.bjut.edu.cn","");
ht.Add("http://lib.bjut.edu.cn", "");
ht.Add("http://news.bjut.edu.cn", "");
ht.Add("http://sse.bjut.edu.cn", "");
ht.Add("http://lexus.cnblogs.com", "");
ht.Add("http://www.sina.com.cn/sport", "");
ht.Add("http://www.sina.com.cn/ent", "");
foreach(var kvp in ht)
Console.WriteLine(kvp.Key);
Console.WriteLine("============================================");
Hashtable ht2=new Hashtable();
ht2.Add("http://www.sina.com.cn", "");
ht2.Add("http://www.bjut.edu.cn", "");
ht2.Add("http://lib.bjut.edu.cn", "");
ht2.Add("http://news.bjut.edu.cn", "");
ht2.Add("http://sse.bjut.edu.cn", "");
ht2.Add("http://lexus.cnblogs.com", "");
ht2.Add("http://www.sina.com.cn/sport", "");
ht2.Add("http://www.sina.com.cn/ent", "");
foreach(DictionaryEntry i in ht2)
Console.WriteLine(i.Key);
芜湖不芜
慕运维8079593
繁星淼淼
随时随地看视频慕课网APP