Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Therefore, Casting from double[][] to double[*,*] cannot be made on some situations. This is probably the reason why you can do the casting either implicitly of explicitly.
I have no idea if you for each dr.read you add the exact number of doubles to that row. If not then you will need to at least know the length of the longest row.
List<double[]> something = new List<double[]>();
int maxLen = 0;
for (int i = 0; i< 5; i++)
{
something.Add(new double[] { 1.0, 2.0 });
maxLen = Math.Max(maxLen, something[something.Count - 1].Length);
}
double[,] doubleArray = new double[something.Count, maxLen];
for (int i = 0; i < something.Count; i++)
{
for (int j = 0; j < maxLen; j++)
{
doubleArray[i, j] = something[i][j];
}
}
If your double[][] doesn't have a rows with the same length then "empty" cells will have the value of 0.0