I have a list of objects:
Dim objList As BindingList(Of Object1)
Each of those contains a list of Object2. I am trying to iterate through objList so that I can remove specific instances of Object2 from each Object1's respective Object2 list:
For Each obj In objList
Dim objRemove = obj.Object2List.Where(AddressOf ObjCheck)
For Each obj2 In objRemove
obj.Object2List.Remove(obj2)
Next
Next
This throws the error, "Collection was modified; enumeration operation may not execute."
What I don't understand is that I am removing an object from Object2List, which is not being enumerated. Why is this error being thrown?