Quantcast
Channel: Answers for "Remove a destroy object from a list, then reload the list"
Browsing latest articles
Browse All 4 View Live

Answer by TehJustice

Haven't dissected the code yet to see if this is the issue, but you should never remove an object in the middle of the foreach loop.

View Article


Answer by Cherno

If you want to iterate through a collection and modify it while doing so (such as removing or adding items), don't use a foreach loop. Use a normal for... loop, but do it in reverse like this, and you...

View Article

Browsing latest articles
Browse All 4 View Live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>