Multidimensional arrays

  • Thread starter Thread starter Tom Jelen
  • Start date Start date
T

Tom Jelen

Hi, i want to make an "int, byte" array thats something like this:

1|byte[]..
2|byte[]..
3|byte[]..
4|byte[]..
5|byte[]..

the byte arrays will be of different lengths, how do i declare one like
that? I can only find examples where its the same type in both
dimensions like int[][]..
 
Hi, i want to make an "int, byte" array
thats something like this:

1|byte[]..
2|byte[]..
3|byte[]..
4|byte[]..
5|byte[]..

the byte arrays will be of different lengths, how
do i declare one like that? I can only find examples
where its the same type in both
dimensions like int[][]..

I think you might have confused the type of Length on arrays with the types
the array can contain?

An array of array of bytes shouldn't be anything else than just an array of
array of bytes...

Just change int from the examples you've seen into byte. An example how to
create an assymetric matrix of bytes:

byte[][] byteMatrix =
{ new byte[2], new byte[3], new byte[5] };

// Bjorn A
 
hrmf, not sure what i was thinking hehe, but thanks!

Bjorn said:
...
Hi, i want to make an "int, byte" array
thats something like this:

1|byte[]..
2|byte[]..
3|byte[]..
4|byte[]..
5|byte[]..

the byte arrays will be of different lengths, how
do i declare one like that? I can only find examples
where its the same type in both
dimensions like int[][]..


I think you might have confused the type of Length on arrays with the types
the array can contain?

An array of array of bytes shouldn't be anything else than just an array of
array of bytes...

Just change int from the examples you've seen into byte. An example how to
create an assymetric matrix of bytes:

byte[][] byteMatrix =
{ new byte[2], new byte[3], new byte[5] };

// Bjorn A
 
Back
Top