C# 遍历Hashtable
来源:互联网 发布:数据库分为哪几种类型 编辑:程序博客网 时间:2024/05/29 00:33
static void Main(string[] args) { Hashtable ht=new Hashtable(); ht.Add("1", "A"); ht.Add("2", "B"); ht.Add("3", "C"); ht.Add("4", "D"); //遍历方法一:遍历哈希表中的键 foreach(string key in ht.Keys) { Console.WriteLine(string.Format("{0}:{1}", key, ht[key])); } Console.WriteLine("**********************************************************"); //遍历方法二:遍历哈希表中的值 foreach(string value in ht.Values) { Console.WriteLine(value); } Console.WriteLine("**********************************************************"); //遍历方法三:遍历哈希表中的键值 foreach(DictionaryEntry de in ht) { Console.WriteLine(string.Format("{0}:{1}", de.Key, de.Value)); } Console.WriteLine("**********************************************************"); //遍历方法四:遍历哈希表中的键值 IDictionaryEnumerator myEnumerator = ht.GetEnumerator(); bool flag = myEnumerator.MoveNext(); while (flag) { Console.WriteLine(myEnumerator.Key + ":" + myEnumerator.Value); flag = myEnumerator.MoveNext(); } Console.Read(); }
阅读全文
0 0
- c#遍历HashTable
- C#中遍历Hashtable
- c#遍历HashTable
- c# hashtable 遍历
- c#遍历HashTable
- C# 遍历Hashtable
- C# 遍历Hashtable
- C# Hashtable的遍历
- C# 遍历Hashtable
- C#中hashtable的遍历
- 如何在C#中遍历hashtable?
- C#中如何遍历Hashtable中的值
- C#遍历访问Dictionary和HashTable
- C#遍历访问Dictionary和HashTable
- C#遍历访问Dictionary和HashTable
- C#中Hashtable的遍历办法
- C#遍历访问Dictionary和HashTable
- 遍历Hashtable
- openssl aes 加密解密示例程序
- GreenPlum 集群 gpfdist 实战
- 链表中倒数第K个节点
- codeforces 789A
- python 对text进行读写小例子非常简单
- C# 遍历Hashtable
- 二叉树的垂直遍历
- D3.js实现折线图的方法详解
- [leetcode: Python]566. Reshape the Matrix
- sql 笔记1
- Gerrit 安装过程中遇到的问题汇总。
- 关于截图工具的总结
- js上下无线滚动大法,跟跑马灯原理差不多
- hdu1018—Big Number