using System; using System.Collections.Generic; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { Program dn = new Program(); int[] array1 = { 1, 2, 3 }; int[] array2 = { 1, 2, 3 }; int[] res = dn.merge(array1, array2); Console.WriteLine(res); } public int[] merge(int[] array1, int[] array2) { int[] array3 = new int[6]; int[] arr4 = new int[6]; int i, j; int array1length = array1.Length; int array2length = array2.Length; //array3 = array1.Concat(array2).ToArray(); for (i = 0; i < array1length; i++) { array3[i] = array1[i]; } int FinalLength = array1length + array2length; for (j = 0; j < array2length; j++) { i++; array3[(i - 1)] = array2[j]; } for (int k = 0; k <= arr4.Length; k++) { arr4 = array3; } return arr4; } } }
Console.WriteLine(res);
Console.WriteLine (string.Join(", ", res));
for (int i = 0; i <= res.Length-1; i++) { Console.WriteLine("{0}",res[i]); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)