[Dotnet][C#]Dictionary的foreach使用KeyValuePair
来源:互联网 发布:圈点软件下载 编辑:程序博客网 时间:2024/05/01 05:59
foreach (KeyValuePair<int, string> kvp in myDictionary) {...}
看到這句就大概可以猜出來了,就是用KeyValuePair,用范例介紹如何使用..
asp.net(c#)
TestKeyValuePair.aspx.cs
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using System.Collections.Generic;
- public partial class TestKeyValuePair : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- Dictionary<string, string> dic = new Dictionary<string, string>();
- dic.Add("Name", "puma");
- dic.Add("Blog", "F6 Team");
- dic.Add("Group", "Dotblogs");
- foreach (KeyValuePair<string, string> item in dic)
- {
- Response.Write(string.Format("{0} : {1}<br/" + ">", item.Key, item.Value));
- }
- }
- }
using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Collections.Generic; public partial class TestKeyValuePair : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Dictionary<string, string> dic = new Dictionary<string, string>(); dic.Add("Name", "puma"); dic.Add("Blog", "F6 Team"); dic.Add("Group", "Dotblogs"); foreach (KeyValuePair<string, string> item in dic) { Response.Write(string.Format("{0} : {1}<br/" + ">", item.Key, item.Value)); } } }
执行結果:
- [Dotnet][C#]Dictionary的foreach使用KeyValuePair
- [C#] Dictionary 如何使用 foreach (KeyValuePair)
- C#中Dictionary的foreach使用KeyValuePair
- Dictionary、List<KeyValuePair<i>>的组合使用
- Unity3d中Dictionary和KeyValuePair的使用
- c#遍历Dictionary使用KeyValuePair
- KeyValuePair 和 Dictionary 的关系
- 在Dictionary使用foreach的注意
- 利用KeyValuePair遍历Dictionary
- KeyValuePair和Dictionary
- Dictionary and KeyValuePair关系
- C# Dictionary的用法 KeyValuePair<TKey, TValue> 结构
- C#for和foreach的区别-----dictionary遍历的方式
- 如何遍历并删除Dictionary集合内容——学会使用 KeyValuePair
- c:forEach标签的使用
- <c:forEach>标签的使用
- <c:forEach>标签的使用
- <c:forEach>标签的使用
- 在iSQL*Plus中启用sys账户登录dba的解决办法
- 不同版本的IE无法安装于同一台机器的问题的解决
- 在Windows和AIX上卸载DB2
- 守护进程
- reactos操作系统实现(93)
- [Dotnet][C#]Dictionary的foreach使用KeyValuePair
- 我要建站了!!!
- 驱动开发环境配置
- MYSQL 手册【摘】
- 八月读书生活
- 一种常用的产生表达式的方式
- JQUERY获取form表单text,areatext,radio,checkbox,select值
- 【转】Linux下使用C语言连接Mysql (commands out of sync, you can't run ...)
- 数据仓库