zoukankan      html  css  js  c++  java
  • HashTable的遍历

     namespace @string
    {
        class Program
        {
            static void Main(string[] args)
            {
                Hashtable HS = new Hashtable();
                HS.Add(1, "apple");//add 方法是想添加键值对
                HS.Add(2, "orange");
                HS.Add(3, "watermelon");
                HS.Add(4, "banana");
                HS.Add(5, "grape");
                HS.Add(6, "melon");
                foreach (DictionaryEntry de in HS)//dictionaryEntry是这个hashtable的入口点
                {
                    Console.WriteLine(de.Value.ToString());
                    Console.WriteLine(de.Key.ToString());
                }
            }
        }
    }
    以上代码实现遍历整个HashTable。res3
  • 相关阅读:
    指针和数组的关系
    深入学习数组
    const关键字与指针
    野指针是什么
    指针带来的一些符号的理解
    指针的本质
    内存管理之堆
    内存管理之栈
    元类
    断点调式和面向对象进阶
  • 原文地址:https://www.cnblogs.com/jessie/p/1440560.html
Copyright © 2011-2022 走看看