If we foreach a object elements in loop, I want to add or delete before, or after some elements. How I can I do at the loop foreach. Please help.
Use for loop instead of foreach and use index to access the Items like:
because if you delete an item from ForEach it will give an exception, since the collection is changed now!