本帖最后由 plglenn11 于 2010-04-10 20:40:43 编辑

解决方案 »

  1.   

    是这样的。 foreach (System.Collections.DictionaryEntry objDE in objHasTab)
    {
        Console.WriteLine(objDE.Key.ToString());
        Console.WriteLine(objDE.Value.ToString());
    }
      

  2.   

    还有这样。
    System.Collections.IDictionaryEnumerator enumerator = objHashTablet.GetEnumerator(); 
    while (enumerator.MoveNext())
    {
        Console.WriteLine(enumerator.Key);         // Hashtable关健字
        Console.WriteLine(enumerator.Value);      // Hashtable值
    }
      

  3.   

    是要遍历hashtable元素中的数组不是hashtable啊
      

  4.   

    sorry,不想去测试,,我看错楼主问题了。。
      

  5.   

    用split是否能满足楼主要求?
      

  6.   

    不需要判断类型的
    直接遍历enumerator.Value
      

  7.   

    是要遍历hashtable元素中的数组不是hashtable啊 
      

  8.   

    哦~  那就在遍历HashTable的基础上再分割每个Value转成数组
      

  9.   

    自己定义存和取的方法  连同数组的type一起存到hash的每个value里
      

  10.   


                Hashtable ht = new Hashtable();
                int[] x = { 1, 2 };
                ht["aa"] = x;
                Int64[] y = { 2, 3, 5 };
                ht["bb"] = y;
                string[] z = { "5", "6", "7" };
                ht["cc"] = z;            foreach (object obj in ht.Keys)
                {
                    Array arr = ht[obj] as Array;
                    if (arr != null)
                    {
                        foreach (object o in arr)
                        {
                            Console.WriteLine(o);
                        }
                    }
                }
      

  11.   

     foreach (System.Collections.DictionaryEntry objDE in objHasTab)
    {
        Console.WriteLine(objDE.Key.ToString());
        Console.WriteLine(objDE.Value.ToString());
    }
      

  12.   

    也可如下
    Hashtable ht = new Hashtable();
            int[] x = { 1, 2 };
            ht["aa"] = x;
            Int64[] y = { 2, 3, 5 };
            ht["bb"] = y;
            string[] z = { "5", "6", "7" };
            ht["cc"] = z;        foreach (object obj in ht.Keys)
            {
                IEnumerable myEnumerable = ht[obj] as IEnumerable;            if (myEnumerable != null)
                {
                    IEnumerator myEnumerator = myEnumerable.GetEnumerator();
                    while (myEnumerator.MoveNext())
                    {
                        Response.Write(myEnumerator.Current);
                    }
                }
            }