Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 14
    You should measure with something like StopWatch instead of DateTime: hanselman.com/blog/… Commented Feb 23, 2015 at 19:26
  • 4
    could you please describe your test scenario, how many items where in your dictionary, how often did you run your scenario to calculate the average time, ... Commented Jul 29, 2015 at 8:57
  • 5
    Interestingly you will get different results depending upon what data you have in the dictionary. While itterating over the Dictionary the Enumerator function has to skip a lot of empty slots in the dictionary which is what causes it to be slower than iterating over an array. If the Dictionary is full up there will be less empty slots to skip than if it is half empty. Commented Jun 30, 2016 at 8:36
  • Perhaps come back here 10 years later to clarify used Dictionary instead of Dictionary. here as it reads like "used red instead of red" at the moment. Commented Jul 10 at 19:39