关于hashtable
object product_id = e.CommandArgument;
Response.Write(product_id);
Hashtable ht = (Hashtable)Session["car"];
foreach (DictionaryEntry de in ht) //ht为一个Hashtable实例
{
Response.Write(de.Key);
}
if (ht.Contains(product_id))
{
Response.Write("true");
}
else
{
Response.Write("false");
}
//ht.Remove(product_id);
我写了上面的程序, Response.Write(product_id)与 Response.Write(de.Key)输出地值是一样的,所以我推断执行 if (ht.Contains(product_id))输出的应该是true,但是实际上输出是false,这是为什么啊?
我是菜鸟,请大侠们帮帮忙,在线等!先谢了!