1

I need to use square matrix of size between 100x100 and 1000x1000.

I only need to read the matrix, modify some values and copy the matrix (many many times!)

It's more efficent to use the rectangular form, like int[][], or the multidimensional form, like int[,] ?

Or there is a better way or a better class to use?

Ginopinoshow
  • 81
  • 2
  • 9
  • 2
    Possible duplicate of [What are the differences between a multidimensional array and an array of arrays in C#?](http://stackoverflow.com/questions/597720/what-are-the-differences-between-a-multidimensional-array-and-an-array-of-arrays) – Nikolay K Feb 26 '16 at 02:21

1 Answers1

2

There are two factors involving when deciding between arrays, Memory and performance. The Multi dimensional array has a good memory management than the jagged array, which is array of arrays. In case of performance, the jagged array is the fastest may be due to poor implementation of CLR. so clearly when you have a matrix form which requires multiple traversals, its better to use jagged arrays though it has some memory hit.

Roy
  • 196
  • 1
  • 10