zoukankan      html  css  js  c++  java
  • C#遍历HashTable

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Collections;
    namespace HashTable
    {
        class HashTableDemo 
        {
     
            public string Get() 
            {
                Hashtable hashTable = new Hashtable();
                hashTable.Add(1, "wuyi");
                hashTable.Add(2, "sky");
                System.Windows.Forms.MessageBox.Show((string)hashTable[1]);
     
                foreach (DictionaryEntry de in hashTable) 
                {
                    System.Windows.Forms.MessageBox.Show(de.Key.ToString());
                    System.Windows.Forms.MessageBox.Show(de.Value.ToString());
                }
     
                System.Collections.IDictionaryEnumerator enumerator = hashTable.GetEnumerator();
                while (enumerator.MoveNext()) 
                {
                     System.Windows.Forms.MessageBox.Show(enumerator.Key.ToString());
                    System.Windows.Forms.MessageBox.Show( enumerator.Value.ToString());
                }
     
                return (string)hashTable[1];
            }
        }
    }
  • 相关阅读:
    Editor HDU
    Out of Sorts II
    庭师的利刃
    HDU 2087: 剪花布条
    【高精度】高精度乘法
    【高精度】高精度数除以低精度数I
    【高精度】高精度阶乘
    【高精度】高精度分数
    【高精度】简单高精度减法
    【高精度】简单高精度加法
  • 原文地址:https://www.cnblogs.com/dfsxh/p/1332700.html
Copyright © 2011-2022 走看看