Collection was modified; enumeration operation may not execute. C# [duplicate]
问题 This question already has answers here : How to remove elements from a generic list while iterating over it? (26 answers) Closed 6 years ago . I need help. I am working with an arraylist, and suddenly I get this error. An unhandled exception of type 'System.InvalidOperationException' occurred in mscorlib.dll Additional information: Collection was modified; enumeration operation may not execute. This is the code where it shows the exception... foreach (PC_list x in onlinelist) { if ((nowtime