当你使用一个List< KeyValuePair< T1,T2>>代替词典&所述的T1,T2和GT ;? [英] When would you use a List<KeyValuePair<T1, T2>> instead of a Dictionary<T1, T2>?

查看:98
本文介绍了当你使用一个List< KeyValuePair< T1,T2>>代替词典&所述的T1,T2和GT ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是KeyValuePair和词典,为同类型列表之间的区别? ?是否有一个合适的时间使用一个或另一个

What is the difference between a List of KeyValuePair and a Dictionary for the same types? Is there an appropriate time to use one or the other?

推荐答案

当你不需要在关键快速查找 - 维持通过词典使用哈希表具有一定的开销。

When you don't need fast lookups on key - maintaining the hashtable used by Dictionary has a certain overhead.

这篇关于当你使用一个List< KeyValuePair< T1,T2>>代替词典&所述的T1,T2和GT ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆