Reputation: 49
I'm having problem with following code:
protected Dictionary<string, object> values;
lock (values)
foreach (KeyValuePair<string, object> k in values) // error here
{} //do something here
In some reason, I'm getting collection was modified error near k, although I have locked values. Why's that? As I understand, other modifying processes should wait behind locked code block, until it's finished.
Upvotes: -2
Views: 39