如何将两个一维字符串数组A和B合并到一个新一维数组C中

解决方案 »

  1.   

                int[] temp1 = new int[12];
                int[] temp2 = new int[13];
                int[] temp3 = new int[temp1.Length + temp2.Length];
                Array.Copy(temp1, temp3, temp1.Length);
                Array.Copy(temp2, temp3, temp1.Length, temp2.Length);
      

  2.   

     
    string[] arr = new string[4];
                string[] tmp = new string[6];
                string[] c = new string[arr.Length + tmp.Length];
                for (int i = 0; i < arr.Length; i++)
                {
                    arr[i] = i.ToString() + "ab";
                }            for (int j = 0; j < tmp.Length; j++)
                {
                    tmp[j] = j.ToString() + "cc";
                }
                arr.CopyTo(c,0);
                tmp.CopyTo(c, arr.Length);
      

  3.   

    呵呵,又先一步。
    就数据的CopyTo()就能合并了。
      

  4.   

    int[] i;
    int[] j;
    List<int> r = new List<int>();
    r.AddRange(i);
    r.AddRange(j);
    int[] c = r.ToArray();