I have two 2D byte arrays that I want to merge. For example:
2D array1: 2D array2: Combined array3:
[1][0][1] [0][1][0] [1][1][1]
[0][0][0] [1][0][1] => [1][0][1]
[1][0][1] [0][1][0] [1][1][1]
I tried like this:
for(int i = 0; i < array3.GetLength(0); i++)
{
for(int j = 0; j < array3.GetLength(1); j++)
{
// Missing a cast
array3[i, j] = array1[i, j] + array2[i, j];
}
}
The line under the comment says it cannot convert to byte
from int
. I was reading this: byte + byte = int... why?, but still couldn't figure out what I want to accomplish.
How would I go about combining them? Thanks in advance!