c#遍历Dictionary使用KeyValuePair
- 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
posted on 2012-02-07 14:14 BarneyZhang 阅读(959) 评论(0) 编辑 收藏 举报