Which is faster/more efficient: Dictionary or Dictionary?

后端 未结 4 1025
隐瞒了意图╮
隐瞒了意图╮ 2021-02-05 16:27

Are enum types faster/more efficient than string types when used as dictionary keys?

IDictionary or IDict         


        
4条回答
  •  旧时难觅i
    2021-02-05 16:53

    Use enum to get cleaner and nicer code, but remember to provide a custom comparer if you are concerned with performance: http://ayende.com/Blog/archive/2009/02/21/dictionaryltenumtgt-puzzler.aspx .

提交回复
热议问题