c#遍历Dictionary使用KeyValuePair
2012-02-07 14:14
597 查看
Dictionary<string, string> dic = new Dictionary<string, string>();
dic.Add("台球网", "www.52taiqiu.com");
dic.Add("台球技巧", "www.52taiqiu.com");
dic.Add("台球视频", "www.52taiqiu.com");
foreach (KeyValuePair<string, string> item in dic)
{
Response.Write(string.Format("{0} : {1}<br/" + ">", item.Key, item.Value));
}
输出结果:
台球网:www.52taiqiu.com
台球技巧:www.52taiqiu.com
台球视频:www.52taiqiu.com
dic.Add("台球网", "www.52taiqiu.com");
dic.Add("台球技巧", "www.52taiqiu.com");
dic.Add("台球视频", "www.52taiqiu.com");
foreach (KeyValuePair<string, string> item in dic)
{
Response.Write(string.Format("{0} : {1}<br/" + ">", item.Key, item.Value));
}
输出结果:
台球网:www.52taiqiu.com
台球技巧:www.52taiqiu.com
台球视频:www.52taiqiu.com
相关文章推荐
- 如何遍历并删除Dictionary集合内容——学会使用 KeyValuePair
- [Dotnet][C#]Dictionary的foreach使用KeyValuePair
- [C#] Dictionary 如何使用 foreach (KeyValuePair)
- C#中Dictionary的foreach使用KeyValuePair
- c#keyvaluepair与Dictionary的配合使用
- Dictionary、List<KeyValuePair<i>>的组合使用
- Dictionary及KeyValuePair使用
- C# Dictionary的用法 KeyValuePair<TKey, TValue> 结构
- 键值对Dictionary、KeyValuePair、Hashtable 简单使用。
- C# winform key value型数据如何绑定ComBox (hashtable,keyvaluepair,dictionary )
- c# Dictionary 遍历,获取key、value
- Unity3d中Dictionary和KeyValuePair的使用
- C#_Dictionary<TKey, TValue>的使用
- C#基础第四天-作业答案-Hashtable-list<KeyValuePair>泛型实现名片
- c#+linq 通过Dictionary的Value查找Key
- Dictionary and KeyValuePair关系
- C# Dictionary通过value获取对应的key值
- C# Dictionary已知value获取对应的key
- VBA中Dictionary对象使用(Key,Value)
- KeyValuePair和Dictionary