So, I found the code snippet as follows:
class CustomDictionary { Dictionary<string, string> backing; ... public string Get(int index) { return backing.ElementAtOrDefault(index);
And then it was used like this:
for(int i=0;i<mydictionary.Count;i++) { var value=mydictionary.Get(i); }
Besides the performance issues and the ugliness in this, is this code really correct? That is, IEnumerable on Dictionary is guaranteed to always return things in the same order, assuming nothing changes with the dictionary during the iteration?
Earlz source share