C# hashtable 怎么用

来源:百度知道 编辑:UC知道 时间:2024/05/09 12:33:27
怎么修改value 值? 如:
ht = new Hashtable();
ht.Add("1", 0);
怎么把key 为 “1” 的value 0改为其它值?

这样一定可以实现
ht.Remove("1");
ht.Add("1","kkkk");
呵呵。这个方法比较笨,但是很实用。

foreach (DictionaryEntry sshs in ht)
{
if(sshs.Key.ToString()=="1")
{
//遍历所有Key
}
}

有关.net的问题,这里都有很详细的讲解,你可以参考一下,方法有很多
参考资料:http://www.baidu.com/s?wd=%B1%B1%B7%E7%CD%F8&rsv_bp=0&rsv_spt=3&inputT=422

ht["1"]=0