When should I use ConcurrentDictionary and Dictionary?

前端 未结 4 1062
余生分开走
余生分开走 2021-02-01 01:05

I\'m always confused on which one of these to pick. As I see it I use Dictionary over List if I want two data types as a Key and Val

4条回答
  •  别跟我提以往
    2021-02-01 01:34

    ConcurrentDictionary is useful when you need to access a dictionary across multiple threads (i.e. multithreading). Vanilla Dictionary objects do not possess this capability and therefore should only be used in a single-threaded manner.

提交回复
热议问题