使用我真的字典,我想,而我通过它枚举去改变它,但似乎这是不允许的。 我怎样才能做到这一点?
I`m using a Dictionary and I want to change it while I Enumerate through it, but it seems this is not allowed. How can I do this?
感谢
您应该存储密钥,或者您想删除打破循环,然后使用删除方法从字典中删除的对象的对象。
You should store the key or object you want to delete and break the loop, and then use remove method to delete the object from dictionary.
希望这有助于