在C#中使用foreach遍历hashtable哈希表的代码

如下的代码内容是关于在C#中使用foreach遍历hashtable哈希表的代码,应该是对小伙伴们也有好处。

using System;
using System.Collection;
namespace HashSampleApplication1
{
  class Program
  {
    static void Main()
    {
     Hashtable hash = new Hashtable();
        hashtable[1] = "kaka";
        hashtable[2] = "biryani";
        hashtable[13] = "kadai";

     foreach (string key in hash.Keys) 
 {
    Console.WriteLine(key + ‘=’ + hash[key]);
 }
    }

  }
}