not equal [,]
No. A byte[][] is a jagged array - an array of arrays. Each element of the "external" array is a reference to a normal byte[] (or a null reference, of course).
A byte[,] is a rectangular array - the only object.
Rectangular arrays do not implement IEnumerable<T> , just not a generic IEnumerable , but you can use Cast to cast each element in a byte :
byte[,] rectangular = ...; var doubled = rectangular.Cast<byte>().Select(x => (byte) x * 2);
This will simply treat the rectangular array as one sequence of bytes, although it is not a sequence of "subarrays" just as if you were with an uneven array, though ... you could not use Cast<byte[]> for example.
Personally, I rarely use multidimensional arrays of any type - what are you trying to achieve here? There may be a better approach.
EDIT: if you are just trying to sum everything in a rectangular array, it is easy:
int sum = array.Cast<byte>().Sum(x => (int) x);
In the end, you donβt care how everything turned out - you just want to get the sum of all the values ββ(provided that I correctly interpreted your question).
source share