I've created a multidimensional array and want to set the entire inner array equal to a separate (single dimensional) array. How can I do this, besides going through each position in the arrays and setting grid[row][val] = inputNums[val]?
int[,] grid = new int[20,20];
// read a row of space-deliminated integers, split it into its components
// then add it to my grid
string rowInput = "";
for (int row = 0; (rowInput = problemInput.ReadLine()) != null; row++) {
int[] inputNums = Array.ConvertAll(rowInput.Split(' '), (value) => Convert.ToInt32(value))
grid.SetValue(inputNums , row); // THIS LINE DOESN'T WORK
}
The specific error I'm getting is:
"Arguement Exception Handled: Array was not a one-dimensional array."