You may not need to concatenate the final result into an adjacent array. Instead, add the list to the list suggested by John. As a result, you will have a jagged array (well, in fact, almost rectangular). When you need to access an element by index, use the following indexing scheme:
double x = list[i / sampleSize][i % sampleSize];
Iterating over a jagged array is also simple:
for (int iRow = 0; iRow < list.Length; ++iRow) { double[] row = list[iRow]; for (int iCol = 0; iCol < row.Length; ++iCol) { double x = row[iCol]; } }
This saves your memory allocation and copying due to slightly slower access to the item. Whether this will increase network performance depends on the size of your data, data access patterns, and memory limitations.
Constantin Nov 20 '08 at 18:49 2008-11-20 18:49
source share