One would imagine this would be a pretty simple task, yet I'm getting a System.InvalidOperationException when I run this code:
Dictionary<string, bool> TableExists = new Dictionary<string, bool>();
//... fill the dictionary
foreach(string value in TableExists.Keys){/*Do something*/}
It is supposed to iterate through the keys of the dictionary TableExists
, but I get the Invalid Operation Exception at the foreach
line. Am I using any Dictionary operations incorrectly? What is the proper way to work through the keys of a C# Dictionary if so?
Edit:
Yes, I was attempting to change some values corresponding to dictionary keys, getting a Collection was modified
error.