public void Remove_NonExistentEntries_DoesNotPreventEnumeration() { const string SubKey = "-sub-key"; var dictionary = new LightDictionary <string, string>(); dictionary.Add("a", "b"); dictionary.Add("c", "d"); foreach (string key in dictionary.Keys) { if (dictionary.Remove(key + SubKey)) { break; } } dictionary.Add("c" + SubKey, "d"); foreach (string key in dictionary.Keys) { if (dictionary.Remove(key + SubKey)) { break; } } }