There are several arrays
int[] array1 = { 1, 0, 1, 0, 0 }; int[] array2 = { 0, 0, 1, 1, 0 }; int[] array3 = { 1, 1, 1, 0, 1 };
how to add them and get one with 15 elements
int[] array4 = { 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1 };
There are several arrays
int[] array1 = { 1, 0, 1, 0, 0 }; int[] array2 = { 0, 0, 1, 1, 0 }; int[] array3 = { 1, 1, 1, 0, 1 };
how to add them and get one with 15 elements
int[] array4 = { 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1 };
Enumerable.Concat Combines two sequences:
var result = array1.Concat(array2.Concat(array3));
using System.Linq;
- SpecterProbably something like this:
int[] array4 = new int[array1.length + array2.length + array3.length]; array1.CopyTo(array4, 0); array2.CopyTo(array4, array1.length); array3.CopyTo(array4, array1.length + array2.length);
Source: https://ru.stackoverflow.com/questions/88909/
All Articles