remove item inside foreach code example
Example 1: c# remove from list in foreach
myList.RemoveAll(x => x.SomeProp == "SomeValue");
Example 2: c# best way to loop and remove
for (int i = safePendingList.Count - 1; i >= 0; i--)
{
// some code
// safePendingList.RemoveAt(i);
}