HI,
Can anyone help me to overcome above error "For Each: Collection was modified; enumeration operation may not execute in dictionary "
When I am trying to add value to the dictionary inside the loop, it’s throwing above error ,
when condition is met it is adding values to dictionary when the condition failed then it is looping 3 to 4 rows then it is throwing the error of above mentioned,
While iteratiing over a sequence (in your case the keys) the looped sequence cannot be modified (deletion / addition…).
For suggesting an altenate solution approach we cannot derive enough details / requirements from the screenshots. Just give us more details on what is to achieve / requirements. Thanks
@Datta_Annaram
It looks like you simalted a GroupBy and aggregated summing up with the help of a dictionary. This is a good to know technique. However we also can do the same with a GroupBy on Datatable.
Find some starter Help demonstraing both approaches: Datta_Annaram.xaml (10.5 KB)