I am brushing up and reviewing some of my C# notes.
I'm running one of his examples for the first time and I am getting this error: Cannot convert type double to double[] error
. To me, the code looks good, I don't know why it's not converting. Why is this line causing an error?
class Program
{
static void Main(string[] args)
{
double[,] list1;
int r = 5, c = 10;
list1 = new double[r, c];
for(int i = 0; i < r; i++)
for(int j = 0; j<c; j++)
list1[i,j] = Convert.ToDouble(Console.ReadLine());
foreach (double [] i in list1) // -- THIS LINE IS GIVING ME THE ERROR --
{
foreach (double j in i)
Console.WriteLine(j);
}
Console.Read();
}
}