Convert IEnumerable to a multidimensional array

Is there a good way to change my previous code:

char[][] board = Enumerable.Repeat(Enumerable.Repeat('-', 7).ToArray(), 7).ToArray(); 

to use multidimensional arrays instead?

eg.

 char[,] = ... 

the array should represent the following data structure:

 ------- ------- ------- ------- ------- ------- ------- 
+1
source share
1 answer
  char[,] board = new char[7,7]; for(int i =0; i< 7; i++) { for (int k = 0; k < 7; k++) { board[i,k] = '-'; } } 

Are you looking for this?

+1
source

Source: https://habr.com/ru/post/1012393/


All Articles