I have this timer function, it gives me following exception.
Collection was modified; enumeration operation may not execute
once i remove the object from hashtable.
what is the solution to implement similar functionality
void timerFunction(object data)
{
lock (tMap.SyncRoot)
{
foreach (UInt32 id in tMap.Keys)
{
MyObj obj=(MyObj) runScriptMap[id];
obj.time = obj.time -1;
if (obj.time <= 0)
{
tMap.Remove(id);
}
}
}