c# - Add Multidimensional Array To List -
i have multidimensional double array number of rows , columns:
var values = new double[rows, columns];
i have list of double arrays:
var doublelist = new list<double[]>();
now, add each column in multidimensional array list. how do that? wrote illustrate want, not work violation syntax.
for (int = 0; < columns; i++) { doublelist.add(values[:,i]; }
you need create new array each column , copy each value it.
either simple for-loop (like other answers show) or linq:
for (int = 0; < columns; i++) { double[] column = enumerable.range(0, rows) .select(row => values[row, i]).toarray(); doublelist.add(column); }
Comments
Post a Comment