In my model I need to be made aware when a particular collection is changed so I am subscribing to the CollectionChanged event of the ObservableCollection. This is working really well except that the operation is fairly resource expensive.
So when client code does:
foreach(Item i in longList)
{
model.ObservableCollection.Add(i);
}
I am running the expensive operation for each iteration when all that is important is the result after the final item is added.
Is there a way of cancelling the currently running event handler if another CollectionChanged event is raised whilst the first is still executing - and then proceed to handle the most recent event?