c#字典vs. hashtable:为什么词字典被偏爱
Dictionary
和Hashtable
存储键值对,但是Dictionary
是C#中的首选选择,出于几个令人信服的原因:
1。增强的类型安全性:
Dictionary
Hashtable
2。卓越的性能:
Dictionary
Hashtable
3。提高了可用性:
Dictionary
>
Hashtable
4。更大的灵活性:
Dictionary
>
Hashtable
>
实现详细信息:
>,如其源代码注释中所示:Dictionary
Hashtable
这重点介绍了
<code>// The generic Dictionary was copied from Hashtable's source</code>
以上是为什么字典比C#中的hashtable更喜欢?的详细内容。更多信息请关注PHP中文网其他相关文章!