HashTable例子:
#region HashTable
#region Add
Hashtable hashTable = new Hashtable();
Hashtable hashTableNews = new Hashtable();
string[] StringArray=new string[];
hashTableNews.Add(, StringArray);
hashTableNews.Add(, );
hashTableNews.Add(,);
Console.WriteLine(hashTableNews.);
object[] Array = new object[];
hashTable.Add(, "第一");
hashTable.Add(, "第二");
hashTable.Add(, "第三");
hashTable.Add(, "第四");
hashTable.Add(, "第五");
hashTable.Add(, "第六");
#endregion
#region Contains
bool ContainsResult = hashTable.Contains();//查找Key值
Console.WriteLine(ContainsResult);
bool ContainsKeysResult = hashTable.ContainsKey();//查找Key值
Console.WriteLine(ContainsKeysResult);
bool ContainsValueResult = hashTable.ContainsValue("第一");//查找Value值
Console.WriteLine(ContainsValueResult);
#endregion
int i = hashTable.Count;
Console.WriteLine(i);
foreach (DictionaryEntry dicEntry in hashTable)
{
Console.WriteLine(" " + dicEntry.Key + " " + dicEntry.Value);
}
foreach (var key in hashTable.Keys)
{
Console.WriteLine(" " + key + " " + hashTable[key]);
}
Hashtable hashTableNew = (Hashtable)hashTable.Clone();//浅表复制,只复制结构 hashTable.CopyTo(Array, );
foreach (var item in Array)
{
Console.WriteLine(" " + item);
}
DictionaryEntry[] Array1 = new DictionaryEntry[];
hashTable.CopyTo(Array1, );
foreach (DictionaryEntry item1 in Array1)
{
Console.WriteLine(" " + item1.Key + " " + item1.Value);
}
#region Equals
Hashtable hashTable1 = new Hashtable();
hashTable1.Add(, "第一");
hashTable1.Add(, "第二");
hashTable1.Add(, "第三");
hashTable1.Add(, "第四");
hashTable1.Add(, "第五");
hashTable1.Add(, "第六");
bool result1 = hashTable.Equals(hashTable1);
Hashtable hashTable2 = new Hashtable();
hashTable2.Add(, "第一");
hashTable2.Add(, "第二");
hashTable2.Add(, "第三");
hashTable2.Add(, "第四");
hashTable2.Add(, "第五");
hashTable2.Add(, "第六");
bool result2 = hashTable.Equals(hashTable2);
Console.WriteLine(result2);
Hashtable hashTable3 = hashTable;
bool result3 = hashTable.Equals(hashTable3);
Console.WriteLine(result3);
#endregion
Console.ReadLine();
hashTable.Remove();
hashTable.Clear(); #endregion
#region Dictionary
Dictionary<string, int> dictionary = new Dictionary<string, int>();
Dictionary<string, string[]> dictionary1 = new Dictionary<string, string[]>();
Dictionary<string, ArrayList> dictionary2 = new Dictionary<string, ArrayList>();
Dictionary<string, emp> dictionary3 = new Dictionary<string, emp>();
Dictionary<string[], int> dictionary4 = new Dictionary<string[], int>();
string[] value = new string[];
value[] = "";
dictionary1.Add("", value);
foreach (var item in dictionary1)
{
Console.WriteLine(" " + item.Key );
foreach (var items in item.Value)
{
Console.WriteLine(" " + items);
}
}
Console.ReadLine();
#endregion

本系列教程:

C#基础总结之八面向对象知识点总结-继承与多态-接口-http://www.cnblogs.com/spring_wang/p/6113531.html

C#基础总结之七面向对象知识点总结1http://www.cnblogs.com/spring_wang/p/6113526.html

C#基础总结之六 DataTable (临时表/数据源) 和Datatable 名片练习http://www.cnblogs.com/spring_wang/p/6113520.html

C#基础总结之五Dictionary<string, string[]>和while循环http://www.cnblogs.com/spring_wang/p/6113514.html

C#基础总结之四List-Hashtable-冒泡排序http://www.cnblogs.com/spring_wang/p/6113504.html

C#基础总结之三循环控制-for-数组-乘法表-arraylisthttp://www.cnblogs.com/spring_wang/p/6113496.html

C#基础总结之二循环控制-运算符http://www.cnblogs.com/spring_wang/p/6113484.html

C#基础总结之一变量常量-if嵌套语句-witch结构-类型转换http://www.cnblogs.com/spring_wang/p/6113476.html

C#基础课程之六(临时表)DataTable使用方法http://www.cnblogs.com/spring_wang/p/6113454.html

C#基础课程之五集合(HashTable,Dictionary)http://www.cnblogs.com/spring_wang/p/6113404.html

C#基础课程之四集合(ArrayList、List<泛型>)http://www.cnblogs.com/spring_wang/p/6113396.html

C#基础课程之三循环语句http://www.cnblogs.com/spring_wang/p/6113383.html

C#基础课程之二变量常量及流程控制http://www.cnblogs.com/spring_wang/p/6113372.html

C#基础课程之一注释和控制台、一些常识http://www.cnblogs.com/spring_wang/p/6113361.html

C#基础第九天-作业答案-储蓄账户(SavingAccount)和信用账户(CreditAccount) http://www.cnblogs.com/spring_wang/p/6113291.html

C#基础第九天-作业-储蓄账户(SavingAccount)和信用账户(CreditAccount) http://www.cnblogs.com/spring_wang/p/6113285.html

C#基础第八天-作业答案-设计类-面向对象方式实现两个帐户之间转账http://www.cnblogs.com/spring_wang/p/6113274.html

C#基础第八天-作业-设计类-面向对象方式实现两个帐户之间转账http://www.cnblogs.com/spring_wang/p/6113258.html

C#基础第七天-作业答案-利用面向对象的思想去实现名片-动态添加http://www.cnblogs.com/spring_wang/p/6113232.html

C#基础第七天-作业-利用面向对象的思想去实现名片-动态添加http://www.cnblogs.com/spring_wang/p/6113224.html

C#基础第六天-作业-利用面向对象的思想去实现名片http://www.cnblogs.com/spring_wang/p/6113028.html

C#基础第六天-作业答案-利用面向对象的思想去实现名片http://www.cnblogs.com/spring_wang/p/6113033.html

C#基础第五天-作业答案-用DataTable制作名片集http://www.cnblogs.com/spring_wang/p/6113022.html

C#基础第五天-作业-用DataTable制作名片集http://www.cnblogs.com/spring_wang/p/6113013.html

C#基础第四天-作业答案-Hashtable-list<KeyValuePair>泛型实现名片http://www.cnblogs.com/spring_wang/p/6113005.html

C#基础第四天-作业-Hashtable-list<KeyValuePair>泛型实现名片http://www.cnblogs.com/spring_wang/p/6113000.html

C#基础第三天-作业答案-集合-冒泡排序-模拟名片http://www.cnblogs.com/spring_wang/p/6112888.html

C#基础第三天-作业-集合-冒泡排序-模拟名片http://www.cnblogs.com/spring_wang/p/6112885.html

C#基础第二天-作业答案-九九乘法表-打印星星http://www.cnblogs.com/spring_wang/p/6112881.html

C#基础第二天-作业-九九乘法表-打印星星http://www.cnblogs.com/spring_wang/p/6112875.html

C#基础第一天-作业答案http://www.cnblogs.com/spring_wang/p/6112872.html

C#基础第一天-作业http://www.cnblogs.com/spring_wang/p/6112867.html

C#-string.Format对C#字符串格式化http://www.cnblogs.com/spring_wang/p/6077098.html

C#基础课程之五集合(HashTable,Dictionary)的更多相关文章

  1. C#基础课程之四集合(ArrayList、List<泛型>)

    list泛型的使用 ArrayList list = new ArrayList(); ArrayList list = ); //可变数组 list.Add("我"); //Ad ...

  2. 集合Hashtable Dictionary Hashset

    #region Dictionary<K,V> Dictionary<string, Person> dict = new Dictionary<string, Pers ...

  3. C#基础总结之五Dictionary<string, string[]>和while循环

    #region 第五天作业 名片集(01) //Dictionary<string, string[]> PersonCard = new Dictionary<string, st ...

  4. C#基础课程之六(临时表)DataTable使用方法

    DataTable 用法:赋取值操作,及报错情况 dataTable.Columns.Add("Name"); //Columns 对象获取该集合的全部列,添加列名. 默认stri ...

  5. C#基础课程之三循环语句

    for循环: ; i < ; i++) { Console.WriteLine("执行"+i+"次"); } while循环: while (true) ...

  6. C#基础课程之一注释和控制台、一些常识

    注释是程序员对代码的说明,以使程序具有可读性.源代码在编译的过程中,编译器会忽略其注释部分的内容. ()行注释 格式为:// 注释内容 用两个斜杠表示注释的开始,直到该行的结尾注释结束. ()块注释 ...

  7. [转帖]C#中字典集合HashTable、Dictionary、ConcurrentDictionary三者区别

    C#中字典集合HashTable.Dictionary.ConcurrentDictionary三者区别 https://blog.csdn.net/yinghuolsx/article/detail ...

  8. Redis基础课程讲义

    Redis基础 课程内容 Redis入门 Redis数据类型 Redis常用命令 在Java中操作Redis 1. 前言 1.1 什么是Redis Redis是一个基于内存的key-value结构数据 ...

  9. C#泛型集合之Dictionary<k, v>使用技巧

    1.要使用Dictionary集合,需要导入C#泛型命名空间 System.Collections.Generic(程序集:mscorlib) 2.描述 1).从一组键(Key)到一组值(Value) ...

随机推荐

  1. [Java拾遗四]JavaWeb基础之Servlet_Request&&Response

    今天来回顾下之前学过Servle的Resquest以及Response的知识.1,Request和Response技术:    rr的作用:        request是请求,封装用户的请求信息.若 ...

  2. MySql的基本操作以及以后开发经常使用的常用指令

    第一章:数据类型和操作数据表MySQL语句的规范(1):关键字与函数名称全部大写(2):数据库名称,表名称,字段名称全部小写(3):SQL语句必须以分号结尾 1:命令行模式启动mysql服务net s ...

  3. javascript效果:手风琴、轮播图、图片滑动

    最近都没有更,就来几个效果充实一下. 都没有进行美化这步. 手风琴: 纯css: <!DOCTYPE html> <html lang="en"> < ...

  4. php读取大文件的方法

    1.使用file 函数直接读取 $starttime = microtime_float(); ini_set('memory_limit','-1'); $file = "testfile ...

  5. RFID 仿真/模拟/监控/拦截/检测/嗅探器

    Sound card based RFID sniffer/emulator (Too tired after recon.cx to do draw the schematics better th ...

  6. HTML解析组件HtmlAgilityPack使用

    HtmlAgilityPack是一个开源的解析HTML元素的类库,最大的特点是可以通过XPath来解析HMTL,如果您以前用C#操作过XML,那么使用起HtmlAgilityPack也会得心应手.目前 ...

  7. python 相关安装和配置

    永久链接: http://michaelzqm.iteye.com/blog/1841966 预览文章: python环境搭建   2013-04-04 博客分类: 综合   一. window环境安 ...

  8. Scala 深入浅出实战经典 第67讲:Scala并发编程匿名Actor、消息传递、偏函数解析

    王家林亲授<DT大数据梦工厂>大数据实战视频 Scala 深入浅出实战经典(1-87讲)完整视频.PPT.代码下载:百度云盘:http://pan.baidu.com/s/1c0noOt6 ...

  9. [LeetCode] Range Sum Query - Immutable & Range Sum Query 2D - Immutable

    Range Sum Query - Immutable Given an integer array nums, find the sum of the elements between indice ...

  10. Infer初体验 for Android

    安装Python Infer下载地址:https://github.com/facebook/infer 配置环境变量 vi ~/.bash_profile #infer export PATH=${ ...