在vb.net 中定义了Private parameterHash As Hashtable;
然后:
parameterHash = New Hashtable
    。。
    parameterHash.Add("region", New List(Of Integer))。转成c#中:int b = Int32.Parse(parameterHash["region"].ToString());报错输入的格式不正确c#要怎么写才能把region的值取出来?谢谢

解决方案 »

  1.   

    vb.net中
     Dim numregion As Integer = parameterHash("region ")(indexNum)就直接可以用,为什么?
      

  2.   

     parameterHash.Add("region", New List(Of Integer))你这里面放的是一个空List里面没有数List<int> list = parameterHash["region"] as List<int>;
    if (list != null && list.Count > 0)
      int b = list[0];既然List都会用泛型,Hashtable为什么不直接用Dictionary(Of String, Of Integer)?
      

  3.   


                Hashtable ht = new Hashtable();
                ht.Add("key", "region");
                Console.WriteLine(ht["key"]);
      

  4.   

    HashTable是以键值对的形式来存储数据的.