I have a collection in a singleton class, called _connectedNodes of type SynchronizedCollection<RemoteMachine.Node>. EVERY single call to access this collection is wrapped in a lock statement identical to the one in the snippet below.
foreach (RemoteMachine.Node node in _instance._connectedNodes)
if (node.Connection.State == RemoteMachine.ConnectionState.Normal)
This code is basically using async sockets to send messages to a group of connected nodes. How could I have had a 'collection was modified' error within this snippet?
View Complete Post