Hi,
If do:
foreach(var a in col) {
a.X = 1;
}
Will my iterator over the collection become invalid?
Thanks
Hi,
If do:
foreach(var a in col) {
a.X = 1;
}
Will my iterator over the collection become invalid?
Thanks
No. You can access the members of the items in the collection. Your code is valid.
What you can't do is modifying the collection itself (by removing or adding items to it) while iterating.
It shouldn't cause a problem. Only if you try to modify the contents of col
by doing col.Remove
or col.Add
would I imagine there would be a problem.