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. 15个专业版响应式WordPress主题

    当你准备创建一个新的网站,你会发现有很多的WordPress主题供你选择,它们强大而且合适.虽然大量的第三方插件可以解决脚本的问题,但这次我们要向你介绍一些完全不同于以往的主题,它们都是专业开发者开发 ...

  2. UC脱茧蜕变,移动资讯市场格局再生变

    日前,UC浏览器正式更名为UC,同时正式发布大数据驱动的独立资讯应用“UC头条”.而整个UC品牌也从工具类升级为优质资讯内容平台,并吹响了向“大数据新型媒体平台”进军的冲锋号.根据UC官方公布的数据显 ...

  3. wicket基础应用(3)——wicket控件的隐藏和显示

    在一个项目,页面经常要显示和隐藏一些控件,用wicket来控制显示和隐藏控件相当的方便. 1.最简单的隐藏和显示方法: wicket的控件大部分都有setVisible(...)方法,用这个方法就可以 ...

  4. Windows Server 2016软件定义存储:Storage Spaces Direct的关键特性

    [TechTarget中国原创] 微软在Windows Server 2016 Technical Preview 2中引入了Storage Spaces Direct.这个特性将本地存储扩展为高可用 ...

  5. UVa 10387- Billiard

    UVa 10387- Billiard Table of Contents 1 题目 2 思路 3 代码 4 参考 1 题目 ============= Problem A: Billiard In ...

  6. Visual Studio 2013 无法正常打开项目文件

    提示:无法打开 vcxproj 因为此版本的应用程序不支持其项目类型 ,若要打开它 请使用支持此类型项目的版本. 检查  AppData\Roaming\Microsoft\VisualStudio\ ...

  7. shell变量注意事项

    概念:变量赋值,变量替换,变量引用,命令替换 variable=22 echo variable 可以在同一行设置多个变量.例如 va1=good   va2=chif va3=beijing  #需 ...

  8. linux中ssh可以登录sftp不能登录解决办法

    我的服务器一直正常使用,平时使用secureCRT进行管理,使用secureFX进行文件的上传下载,突然有一天secureFX连接的时候出问题了,secureFX的日志如下: i SecureFX 版 ...

  9. Requirejs加载超时问题的一个解决方法:设置waitSeconds=0

    有时Requirejs会遇到加载js超时问题 除了排查js脚本问题,网络问题以外的一个解决方法是加大Require的等待时间waitSeconds,或者直接设置为0,这个参数的意义是:The numb ...

  10. A CIRCULAR PROGRESSBAR STYLE USING AN ATTACHED VIEWMODEL

    This blog post describes how to re-template the Silverlight ProgressBar control to render a circular ...