Foreach loop converting error in C# -
this question has answer here:
i brushing , reviewing of c# notes.
i'm running 1 of examples first time , getting error: cannot convert type double double[] error
. me, code looks good, don't know why it's not converting. why line causing error?
class program { static void main(string[] args) { double[,] list1; int r = 5, c = 10; list1 = new double[r, c]; for(int = 0; < r; i++) for(int j = 0; j<c; j++) list1[i,j] = convert.todouble(console.readline()); foreach (double [] in list1) // -- line giving me error -- { foreach (double j in i) console.writeline(j); } console.read(); } }
you can tell type of elements in array line in code:
list1[i,j] = convert.todouble(console.readline());
the array contains doubles
, not arrays
two dimensional arrays in c# real arrays, not array of arrays
Comments
Post a Comment