大概的代码如下:
Hashtable AAA= new hashtable();
AAA= Hashtable.Synchronized(new Hashtable());
在一个定时器响应函数里这么写的:
IDictionaryEnumerator myEnumerator = AAA.GetEnumerator();
myEnumerator.reset()
while (myEnumerator.MoveNext())
{
if (条件)
{
AAA[myEnumerator.Key]=(int)myEnumerator.Value-1;
}
else
{
AAA.Remove(myEnumerator.Key);
}
}
想要的结果是每次定时运行函数都把hash表内的项目遍历一次,然后修改或者删除。结果现在走一遍就没响应了。应该怎么写?谢谢!