Similar to that big list on Wikipedia of "if you modulo with a negative number as right operand, what happens?", someone should make a list of every programming language and make a similar by-language list of "what happens if you are enumerating over the built-in dictionary type, and you [add a key to the dictionary]/[delete the key of the currently enumerated key-value pair from the dictionary]?"
0 Boosts
0 Likes
UPDATE: Okay so fortunately, the relevant question on StackOverflow got one last reply before all the humans stopped contributing to the site.
".NET Core 3.0+ only: The only mutating methods which do not invalidate enumerators are Remove and Clear."
That's so helpful! Now I only need to solve one of the hardest problems in computer science: Figuring out which version of the .NET standard library is installed on the particular computer you are using for development
@mcc It can't whisper sweet Nothings to you. That's VB.NET, not C#.
Wait, no. I know how to get an answer to my question. **Pulls up Claude at claude.com** **Speaking clearly into the computer mouse** "Claude. Please lie to me convincingly about the behavior of C# IReadOnlyDictionary<T,K>.Enumerator"