首页 > Windows开发 > 详细

C#中Dictionary的用法

时间:2014-12-18 13:24:09      阅读:340      评论:0      收藏:0      [点我收藏+]

Dictionary<string, string>是一个泛型

举例:

bubuko.com,布布扣
1 Dictionary<int, string> dic = new Dictionary<int, string>();
2 
3 dic.add(1,"asd");
4 dic.add(2,"dssa");
5 
6 string a=dic[1];
View Code
bubuko.com,布布扣
1 var result=from s in dic
2                 oerderby s.key
3                 select s.value
4 
5 foreach( KeyValuePair<int, string> s in result)
6 {
7     response.write("Key:{0}, Value:{1}", s.Key, s.Value)
8 }
View Code

 

C#中Dictionary的用法

原文:http://www.cnblogs.com/tider1999/p/4171438.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!