Say I have a
List<double[]> x = new List<double[]>();
double[] item = new double[] {1.0,2.0,3.0};
x.add(item);
etc...
Is there a faster/cleaner way to get this into a double[,] then looping it:
double[,] arr = new double[x.Count,3];
for (row = 0; row < x.Count; row++)
{
for (col = 0; col < 3; col++)
arr[row,col] = x[row][col];
}
Thanks.
No, there isn’t.
Multi-dimensional arrays are strange beasts and are not widely accepted or used in the BCL.
They’re also slow and should be avoided where possible.