ASP.NET Dictionary 的基本用法
2013-12-06 10:42
253 查看
Dictionary<string, string> o_Dic = new Dictionary<string, string>(); //添加元素 o_Dic.Add("01", "aaa"); o_Dic.Add("02","bbb"); //判斷某個key是否存在 if (!o_Dic.ContainsKey("03")) { o_Dic.Add("03", "ccc"); } //移除某個 o_Dic.Remove("03"); //取某個的值 string a = o_Dic["02"]; //遍歷 foreach (KeyValuePair<string, string> kvp in o_Dic) { Response.Write(kvp.Key + "," + kvp.Value); } //遍歷key foreach (string s in o_Dic.Keys) { } //遍歷value foreach (string s in o_Dic.Values) { }
相关文章推荐
- ASP.NET中Dictionary基本用法实例分析
- ASP.NET中Dictionary基本用法实例分析
- ASP.NET Dictionary 的基本用法示例介绍
- ASP.NET Dictionary 的基本用法示例介绍
- Asp.Net MVC 2.0 Filter基本用法
- ASP.NET Repeater_第一篇_基本用法
- Asp.Net MVC 2.0 Filter基本用法
- ASP.NET验证控件使用详解,介绍了基本属性和用法
- AjaxPro2在Asp.net中的基本用法
- ASP.NET中Response的基本用法
- AspNet pager 分页的基本用法
- CKEditor 3.6 + CKFinder 2.0在Asp.Net中的配置与基本用法
- CKEditor 3.6 + CKFinder 2.0在Asp.Net中的配置与基本用法
- ASP.NET AjaxControlToolkit 的基本用法
- CKEditor 3.6 + CKFinder 2.0在Asp.Net中的配置与基本用法
- ASP.NET中的三个富数据控件:GridView,Repeater,DataList的基本用法
- ASP.NET Repeater_01_基本用法
- CKEditor 3.6 + CKFinder 2.0在Asp.Net中的配置与基本用法
- ASP.NET中的验证相关知识 及 Login 控件的基本用法