Copy one jagged array ontop of another.

Posted by George Johnston on Stack Overflow See other posts from Stack Overflow or by George Johnston
Published on 2010-03-31T01:27:50Z Indexed on 2010/03/31 1:33 UTC
Read the original article Hit count: 339

Filed under:
|

How could I accomplish copying one jagged array to another? For instance, I have a 5x7 array of:

0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0

and a 4x3 array of:

0,1,1,0
1,1,1,1
0,1,1,0

I would like to be able to specify a specific start point such as (1,1) on my all zero array, and copy my second array ontop of it so I would have a result such as:

0, 0, 0, 0, 0, 0, 0
0, 0, 1, 1, 0, 0, 0
0, 1, 1, 1, 1, 0, 0
0, 0, 1, 1, 0, 0, 0
0, 0, 0, 0, 0, 0, 0

What would be the best way to do this?

© Stack Overflow or respective owner

Related posts about c#

Related posts about jagged-arrays