?
Solved

Jagged Array

Posted on 2004-08-09
2
Medium Priority
?
281 Views
Last Modified: 2008-03-04
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
Comment
Question by:Kobi55
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Expert Comment

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

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

Accepted Solution

by:
drichards earned 1500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month12 days, 9 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question