学用 ASP.Net 之 System.Collections.Specialized.StringDictionary 类
StringDictionary 相当于 Key 和 Value 都是字符串的哈希表.
主要成员:
/* 属性 */ Count; // Keys; //键集合 Values; //值集合/* 方法 */ Add(); // Clear(); // ContainsKey(); //是否包含指定键 ContainsValue(); //是否包含指定值 CopyTo(); //将指定值赋值到数组 Remove(); //根据键删除
简单练习:
protected void Button1_Click(object sender, EventArgs e) {StringDictionary sd = new StringDictionary();sd.Add("k1", "AAA");sd.Add("k2", "BBB");sd.Add("k3", "CCC");sd["k2"] = "bbb";string str = "";foreach (DictionaryEntry de in sd) //System.Collections.DictionaryEntry{str += string.Format("{0}:{1}; ", de.Key, de.Value);}TextBox1.Text = str; //k1:AAA; k2:bbb; k3:CCC; } protected void Button2_Click(object sender, EventArgs e) {StringDictionary sd = new StringDictionary();sd.Add("k1", "AAA");sd.Add("k2", "BBB");sd.Add("k3", "CCC");string str1, str2;str1 = str2 = "";foreach (string s in sd.Keys) { str1 += s + ","; } //k1,k2,k3,foreach (string s in sd.Values) { str2 += s + ","; } //AAA,BBB,CCC,TextBox1.Text = str1 + "\n" + str2; }
转载于:https://www.cnblogs.com/del/archive/2011/01/07/1929841.html
学用 ASP.Net 之 System.Collections.Specialized.StringDictionary 类相关推荐
- 学用 ASP.Net 之 System.Collections.Specialized.CollectionsUtil 类
通过 CollectionsUtil 创建或包装的 "键/值对" 类(实现 IDictionary 的), 可以忽略 Key 的大小写. 主要成员: /* 静态方法 */ Coll ...
- 学用 ASP.Net 之 System.Collections.Hashtable 类与 DictionaryEntry 结构
DictionaryEntry 是包含 Key / Value 一对值的简单结构; Hashtable(哈希表)是一组 Key / Value 的集合, 准确地讲是一组 DictionaryEntry ...
- 学用 ASP.Net 之 System.Char 结构
成员: /* 常数字段 */MaxValue //65535MinValue //0/* 静态方法 */Char.ConvertFromUtf32() //转 Unicode 值到字符串Char.Co ...
- ASP.NET 使用 System.Web.Script.Serialization 解析 JSON (转)
JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式.易于人阅读和编写.同时也易于机器解析和生成.它基于JavaScript Programming Langu ...
- 类型实现《程序员的第一年》--------------C#中System.Collections.Generic.SortedDictionary 的使用...
在改章节中,我们主要介绍类型实现的内容,自我感觉有个不错的建议和大家分享下 SortedDictionary<TKey,TValue> 类型参数 TKey 字典中的键的类型. TValue ...
- .NET 4.0新增命名空间:System.Collections.Concurrent
集合类的需求总是源源不断,因此,不管是1.0到2.0的泛型,还是3.0到4.0的并行(本文的并行指Concurrent,非 Parallel),.NET每个版本总会伴随着一些集合类的增长.由于并行计算 ...
- System.Collections深入探讨--如何创建自定义的集合类
关键字:collection集合,ArrayList数组队列,Generic 泛型,List<T>列表,自定义集合类 正文: 在System.Collections namespa ...
- 小汤学编程之JAVA基础day11——集合框架:List/Set/Map集合、Collections集合工具类、泛型、TreeMap和TreeSet
一.集合的特点 二.继承结构图 三.List集合 1.特点 2.ArrayList类 3.LinkedList类 4.两者的对比 5.集合的遍历 四.Set集合 1.特 ...
- Resx 文件无效。未能加载 .RESX 文件中使用的类型 System.Collections.Generic.List`1请确保已在项目中添加了必需的引用。
在C#程序编写过程中,会遇到:Resx 文件无效.未能加载 .RESX 文件中使用的类型 System.Collections.Generic.List1`请确保已在项目中添加了必需的引用. 主要原因 ...
- Unity3d:Unknown type 'System.Collections.Generic.CollectionDebuggerView'1
问题描述:如图,在调试状态下说:Unknown type 'System.Collections.Generic.CollectionDebuggerView'1 <ignore_js_op&g ...
最新文章
- Linux统计行数命令wc(转)
- 熟悉一下oncontextmenu事件的知识
- SAP Fiori Elements - smart field id generation
- SecureCRT Application 已停止工作
- 收件箱java项目源码,Java物资管理系统项目源码(含数据库).zip
- ascii码java生成_Java 生成 ASCII 字符画 实现代码
- UE4 iOS设备的兼容性
- 交个朋友回应罗永浩3年还清6亿元:争取年底还完
- win10怎么用计算机的搜索,win10 搜索用不了的问题
- npm打包项目报错:npm ERR! A complete log of this run can be found in:npm ERR! C:\Users\AppData\Roa...
- 数据结构试卷及答案(九)
- 人脸识别 android demo,Android集成人脸识别demo分享
- Spring的IOC和AOP原理及其使用
- 网络原理考点之ADSL组网技术
- 世界首富马斯克突然吟了一首中文诗
- 直方图均衡(HE)与局部色调映射(LTM)
- linux kvm参数,virt-install创建kVM参数
- 学习excel的使用技巧复制一列文本成新列去重
- 淘宝中的UV,PV,IPV
- php获取cnzz数据,PHP curl抓取cnzz统计数据