I have an ArrayList (activeWatches) that holds references to an object (activeWatch). I need to remove items based on a condition in the object. The problem is, I don't know how to remove the item without getting an error. Here's the code I have now.
foreach (WatchItem activeWatch in activeWatches)
{
if (activeWatch.CanDelete())
activeWatches.Remove(activeWatch);
}
Because the number of activeWatches changes inside the loop, I get an error. Any ideas on how to do this?
Craig Berntson
MCSD, Visual FoxPro MVP, Author, CrysDev: A Developer's Guide to Integrating Crystal Reports"
foreach (WatchItem activeWatch in activeWatches)
{
if (activeWatch.CanDelete())
activeWatches.Remove(activeWatch);
}
Because the number of activeWatches changes inside the loop, I get an error. Any ideas on how to do this?
Craig Berntson
MCSD, Visual FoxPro MVP, Author, CrysDev: A Developer's Guide to Integrating Crystal Reports"