In my model, I need to know when a particular collection changes, so I subscribe to the CollectionChanged ObservableCollection event. This works very well, except that the operation is quite expensive.
So, when is the client code:
foreach(Item i in longList)
{
model.ObservableCollection.Add(i);
}
I perform an expensive operation for each iteration when all that matters is the result after adding the last element.
Is there a way to cancel the current event handler if another CollectionChanged event was raised while the first is still running - and then go on to handle the last event?
source
share