#So im trying to delete object from the list in foreach loop.

1 messages · Page 1 of 1 (latest)

hollow wind
#

You can't change a collection while iterating over it with foreach.
Use a for loop with RemoveAt instead.

ruby sinew
#

you can do:

var iteratableList = mainSpawner.mailButtons.ToList(); // creates a copy
```Iterate one, change the other
near kettle
#

Is that because if you remove it from the foreach than the number of iterations would change partway through?

latent cairn