[C#] Dictionary 如何使用 foreach (KeyValuePair)
来源:互联网 发布:比赛顺序抽签软件 编辑:程序博客网 时间:2024/05/05 03:00
這個也是很常用,也來記錄一下。
參考:http://msdn.microsoft.com/zh-tw/library/5tbh8a42.aspx
01
using
System.Collections;
02
namespace
KeyValuePairTest {
03
class
Program {
04
private
static
Dictionary<
string
,
string
> _DicList;
05
static
void
Main(
string
[] args) {
06
_DicList =
new
Dictionary<
string
,
string
>();
07
_DicList.Add(
"s1"
,
"test1"
);
08
_DicList.Add(
"s2"
,
"test2"
);
09
_DicList.Add(
"s3"
,
"test3"
);
10
11
foreach
(KeyValuePair<
string
,
string
> item
in
_DicList) {
12
Console.WriteLine(item.Value);
13
}
14
15
Console.ReadKey();
16
}
17
}
18
}
輸出結果:
三小俠 小弟獻醜,歡迎指教
- [C#] Dictionary 如何使用 foreach (KeyValuePair)
- [Dotnet][C#]Dictionary的foreach使用KeyValuePair
- C#中Dictionary的foreach使用KeyValuePair
- c#遍历Dictionary使用KeyValuePair
- Dictionary、List<KeyValuePair<i>>的组合使用
- Unity3d中Dictionary和KeyValuePair的使用
- 如何遍历并删除Dictionary集合内容——学会使用 KeyValuePair
- 利用KeyValuePair遍历Dictionary
- KeyValuePair和Dictionary
- Dictionary and KeyValuePair关系
- KeyValuePair 和 Dictionary 的关系
- 如何在c:forEach中使用索引
- 如何在c:forEach中使用索引
- 在Dictionary使用foreach的注意
- 不使用foreach遍历一个Dictionary
- 如何使用Dictionary对象?(
- C#如何使用Dictionary
- KeyValuePair
- Socket粘包问题
- 2012春节长假IT系统运维支招之管理篇
- mysql学习之--3、mysql数据类型
- make clean与make distclean的区别
- Jump LA4727
- [C#] Dictionary 如何使用 foreach (KeyValuePair)
- 参考其他文章写的磁盘监控并发邮件的Shell程序
- python split分隔字符串之分隔次数
- 让irrlicht 支持中文
- 开通了,哈哈
- maven环境快速搭建
- 关于浏览器自动加上<pre>标签
- ORACLE 10G安装文档for RedHat 5.4
- 网站首屏下载时间决定电子商务输赢