Hashtable元素的删除
2中方法
Remove();
Clear();
static void Main(string[] args) { Hashtable ht = new Hashtable(); ht.Add(1,"张三"); ht.Add(true,"李四"); ht.Add(3,"王五"); foreach (DictionaryEntry item in ht) { Console.WriteLine("键{0},值{1}",item.Key,item.Value); } Console.WriteLine("-------------------------------------"); ht.Remove(1); //移除键为1的列 foreach (DictionaryEntry item in ht) { Console.WriteLine("键{0},值{1}", item.Key, item.Value); } Console.Read(); ht.Clear();//清空所有元素 }