今天忘记在哪遇到的KeyValuePair这个词,瞬间有点懵逼.........

之前没遇到过,查查资料,留个笔记,从网上看看,用网上大佬的例子吧

KeyValuePair 和 Dictionary 的关系
1、KeyValuePair     Pair(n. 一对,一双,一副vt. 把…组成一对)的意思
a、KeyValuePair 是一个结构体(struct);哎关于结构与类的区别,遇到再解决吧;暂时是声明结构直接就是:StructTest.name="1212";声明类:ClassTest  c=new ClassTest; c.Name="4545";
b、KeyValuePair 只包含一个Key、Value的键值对。
2、Dictionary 
a、Dictionary 可以简单的看作是KeyValuePair 的集合;
b、Dictionary 可以包含多个Key、Value的键值对。

1 Dictionary<int, string> myDic = new Dictionary<int, string>();
2 foreach (KeyValuePair<int, string> item in myDic)
3 {
4     Console.WriteLine("Key = {0}, Value = {1}", item.Key, item.Value);
5 }

View Code

转载于:https://www.cnblogs.com/ZkbFighting/p/8994479.html

KeyValuePair相关推荐

  1. 工具类—KeyValuePair

    工具类KeyValuePair .h文件 #ifndef C11LEARN_KEYVALUEPAIR_H #define C11LEARN_KEYVALUEPAIR_Hclass KeyValuePa ...

  2. KeyvaluePair 与 DictionaryEntry

    如同Dictionary<TKey, TValue>是HashTable的泛型版本一样,KeyValuePair<TKey, TValue>是DictionaryEntry的泛 ...

  3. 键值对Dictionary、KeyValuePair、Hashtable 简单使用。

    KeyValuePair是单个的键值对对象.KeyValuePair可用于接收combox选定的值. 例如:KeyValuePair<string, object> par = (KeyV ...

  4. KeyValuePair 和 Dictionary 的关系

    KeyValuePair 和 Dictionary 的关系 1.KeyValuePair  a.KeyValuePair 是一个结构体(struct):     b.KeyValuePair 只包含一 ...

  5. keyvaluepair_c# KeyValuePair用法

    private KeyValuePair SetKeyValuePair() { int intKey = 1; string strValue = "My value"; Key ...

  6. keyvaluepair_Dictionary及KeyValuePair使用

    /// ///除去数组中的空值和签名参数并以字母a到z的顺序排序/// /// 过滤前的参数组 /// 过滤后的参数组 public static Dictionary FilterPara(Sort ...

  7. keyvaluepair_【转】KeyValuePair用法

    KeyValuePair用法(转) C# KeyValuePair的用法.结构体,定义可设置或检索的键/值对.也就是说我们可以通过它记录一个键/值对这样的值.比如我们想定义一个ID(int类型)和Na ...

  8. java类似keyvaluepair_Java中仿C#中KeyValuePair序列化jsonObject

    /// /// 序列化JSONObject对象 /// /// /// public static string SerializeObject(JSONObject jsonObject) { St ...

  9. KeyValuePair和Dictionary详解:

    1.KeyValuePair      a.KeyValuePair 是一个结构体(struct):     b.KeyValuePair 只包含一个Key.Value的键值对. 2.Dictiona ...

最新文章

  1. Scala函数的调用
  2. leetcode 64. 最小路径和
  3. python编程设计_Python程序设计
  4. why context node binding does not work in pop up window case
  5. 数学告诉你家庭关系的奥秘
  6. 数论练习1 ( 曹冲养猪 + [POJ 2891]Strange Way to Express Integers + 乘法逆元【带证明】)
  7. eclipse jrebel插件
  8. routing zuul_金三银四跳槽季快到了:送上Spring cloud全家桶系列之Zuul
  9. html¥符号代码是什么,html怎么特殊符号赋
  10. python 取json下某一key_利用Python爬取全国250m精度的人口数据、房价数据和公交站(线路)等数据(一)...
  11. Atitit 防伪防篡改方法总结关键数据的防篡改检验方法
  12. mysql修改、删除数据记录
  13. 巧用万能驱动包安装驱动
  14. mac的系统语言怎么设置为中文
  15. NTCUTTER BD-1002013年新包装通知
  16. VRchat上传角色error无法保存蓝图解决
  17. 2022年中国航天发射列表(全年64发)
  18. 搜狐首页出现一个硕大的错别字
  19. 2016年7月8日公司集体的集会,巴南区的樵坪度假村
  20. k8s跨namespace访问服务

热门文章

  1. apex之 程序构建器
  2. Template简介
  3. Linux将目录设置为所有人都能读写
  4. Python逃生游戏
  5. 古人“吃醋”引发的严重后果刘继兴新浪博客
  6. 杰理之测试失真度【篇】
  7. 内容井喷,营销加码,2020网络电影的热趋势与冷观察
  8. 华为emui10鸿蒙,不亚于华为鸿蒙OS的EMUI10.0,到底带来了哪些惊喜?
  9. vivoz3android,vivo旗下最具性价比机型:vivoZ3试用体验
  10. anaconda配置python3.5_win10系统下Anaconda3安装配置方法图文教程