Try to update list items

Hi Team,
i am trying to update list items using foreach directly ,but i am getting error like “For Each currentNumber: Collection was modified; enumeration operation may not execute.”

@Naveen_Kumar6

you cannot update the enumeration list in the same loop

instead create loop using Enumerable.Range(0,list_num.count).ToArray

and inside loop use Update list item

cheers

1 Like