I’m using a Dictionary<long, bool> and I want to change it while I enumerate through it, but it seems this is not allowed.
How can I do this?
I’m using a Dictionary<long, bool> and I want to change it while I enumerate
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should store the key or object you want to delete and break the loop, and then use the Remove() method to delete the object from the dictionary.