Solved

# Jagged Array

Posted on 2004-08-09
275 Views
Hi
i Have A Jagged Array
i'm  trying to insert a Regular Array to Jagged Array  in loop
please show me how to it correctly

int [][,] GetJArray ;
GetJagArray = new int [3][,] ;

int GetArray[,] ;
GetArray = new int[5,3] ;

for ( byte i = 0 ;  i < 5 ; i ++ )
GetJagArray = new int[,]  {GetArray[i]} ;

0
Question by:Kobi55

LVL 4

Expert Comment

ID: 11753418
I've read the question 5 times, and I still can't figure out what you are trying to do.

1)  The jagged array
2) The regular array
3) where do you want to insert the normal array?
0

LVL 19

Accepted Solution

drichards earned 500 total points
ID: 11753452
Not sure exactly what you're trying to accomplish, but this copies a regular arrayinto a jagged array, although the jagged array is not really jagged if you copy a regular array into it as all rows are same length.  Your original code only gave the jagged array a first dimension of 3, so you could not loop i = 1 to 5 in that case.  I changed jagged array first dimension to 5.

int [][] GetJagArray = new int [5][] ;
int[,] GetArray = new int[5,3] ;
// Need to put some values in GetArray - not shown here.

for ( byte i = 0 ;  i < 5 ; i ++ )
{
GetJagArray[i] = new int[3];
for ( int jj = 0; jj < 3; jj++ ) { GetJagArray[i][jj] = GetArray[i,jj]; }
}

0

## Featured Post

### Suggested Solutions

Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…