Dictionary<int, string> dc = new Dictionary<int, string>();
dc.Add(, "看了");
dc.Add(, "没看");
dc.Add(, "不知道"); dc[] = "哈哈"; foreach (KeyValuePair<int,string> item in dc)
{
Console.WriteLine("{0}---{1}", item.Key, item.Value);
} //foreach (var item in dc.Keys)
//{
// Console.WriteLine("{0}---{1}", item, dc[item]);
//} Console.ReadKey();

C#Dictionary 实例的更多相关文章

  1. C# 集合类 :(Array、 Arraylist、List、Hashtable、Dictionary、Stack、Queue)

    我们用的比较多的非泛型集合类主要有 ArrayList类 和 HashTable类.我们经常用HashTable 来存储将要写入到数据库或者返回的信息,在这之间要不断的进行类型的转化,增加了系统装箱和 ...

  2. 泛型Dictionary的用法详解

    泛型最常见的用途是泛型集合,命名空间System.Collections.Generic 中包含了一些基于泛型的集合类,使用泛型集合类可以提供更高的类型安全性,还有更高的性能,避免了非泛型集合的重复的 ...

  3. 类 Array Arraylist List Hashtable Dictionary

    总结C# 集合类 Array Arraylist List Hashtable Dictionary Stack Queue  我们用的比较多的非泛型集合类主要有 ArrayList类 和 HashT ...

  4. JavaScript 字典(Dictionary)

    TypeScript方式实现源码 //  set(key,value):向字典中添加新元素. //  remove(key):通过使用键值来从字典中移除键值对应的数据值. //  has(key ...

  5. 浅析C# Dictionary实现原理

    目录 一.前言 二.理论知识 1.Hash算法 2.Hash桶算法 3.解决冲突算法 三.Dictionary实现 1. Entry结构体 2. 其它关键私有变量 3. Dictionary - Ad ...

  6. Dictionary实现(收藏的)

    源文献:https://www.cnblogs.com/InCerry/p/10325290.html 对于C#中的Dictionary类相信大家都不陌生,这是一个Collection(集合)类型,可 ...

  7. Swift3.0P1 语法指南——下标

    原档:https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programmi ...

  8. php中"::"双冒号有什么作用

    PHP代码 lazycms::$sysname 第一次见到这种表现方式,请问是双冒号什么意思 答:直接属类的方法或属性.也就是static 静态方法或属性的使用.域运算符,一般用于在B类对象中使用A类 ...

  9. swift学习笔记之-下标脚本

    //下标脚本subscript import UIKit /*下标脚本(Subscripts) 下标脚本: 1.可以定义在类(Class).结构体(structure)和枚举(enumeration) ...

随机推荐

  1. php empty和isset的区别

    通过一个例子来解释一下, $id = 0  empty($id) 的值是true isset($id) 也是true. empty 和isset 处理对象无外乎 未定义常量 .0 .空字符串 如果变量 ...

  2. js 音乐

    define(function(require,exports,module){ var $music = document.getElementById('music'); var $music_m ...

  3. mysql 分区信息查看

    select partition_name part,partition_expression expr,partition_description descr,table_rows from INF ...

  4. d3可视化实战04:事件绑定机制

    首先说明,d3支持所有的JS事件——甚至其他代码的自定义事件.这里有一个列表,The MDN Event Reference, 包含了几乎所有浏览器创建的事件类型.大家有需要可以去查看. D3的事件绑 ...

  5. 转:用 git 下载 uboot 源码

    1. 起因: 想下载 uboot 源码,原先的方法都是下载压缩包,然后放到虚拟机上的 Ubuntu ,再解压. 在看 uboot 源码的时候,发现 v2016.01 版本的uboot中关于 board ...

  6. 数组、List和ArrayList的区别

    有些知识点可能平时一直在使用,不过实际开发中我们可能只是知其然不知其所以然,所以经常的总结会对我们的提高和进步有很大的帮助,这里记录自己在工作之余的问题,持续更新,欢迎高手斧正. 数组.List和Ar ...

  7. 转载-常用API接口签名验证参考

    原文地址: http://www.cnblogs.com/hnsongbiao/p/5478645.html 写的很好,就做个笔记了.感谢作者! 项目中常用的API接口签名验证方法: 1. 给app分 ...

  8. ie版本判断的js hack

    常用来判断各种浏览器版本的 ie js hack如下: 1. <!–[if !IE]><!–> 除IE外都可识别 <!–<![endif]–> 2. < ...

  9. [LeetCode] 179. Largest Number 解题思路

    Given a list of non negative integers, arrange them such that they form the largest number. For exam ...

  10. libvirt TLS

    博客原文 http://hi.baidu.com/wwfmarcpjkbdiod/item/7b43c89e949d7fbbcd80e590 构建Libvirt的x509证书远程tls连接http:/ ...