日期:2014-05-17  浏览次数:20782 次

哈希表转换数组的问题
我有一个哈希表,他的value是这样的object.Tittle,都是有.的,我想把.两边的字符放进string数组
比如string[0]=object,string[1]=Tittle,string[2]=object1,string[3]=Tittle1...........

------解决方案--------------------


        object[] a = new object[30];
        
        Hashtable ht = new Hashtable();
        ht.Add("a", "a1");
        ht.Add("b", "b1");
        ht.Add("c", "c1");
        ht.CopyTo(a, 0);
        //转为string
        string[] s = Array.ConvertAll<object, string>(a, delegate(object o) { return o == null ? "" : o.ToString(); });