Why is Dictionary preferred over Hashtable in C#?

后端 未结 19 1269
长情又很酷
长情又很酷 2020-11-22 05:53

In most programming languages, dictionaries are preferred over hashtables. What are the reasons behind that?

19条回答
  •  太阳男子
    2020-11-22 06:21

    FYI: In .NET, Hashtable is thread safe for use by multiple reader threads and a single writing thread, while in Dictionary public static members are thread safe, but any instance members are not guaranteed to be thread safe.

    We had to change all our Dictionaries back to Hashtable because of this.

提交回复
热议问题