日期:2014-05-18 浏览次数:20483 次
int row = 2, col = 3; string[,] array=new string[10,10]; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { array[i, j] = "1"; } } int length1 = array.GetLength(0); int length2 = array.GetLength(1); int startRow = length1 / 2 - (row / 2 - 1) - 1 ; int startCol = length2 / 2 - (col / 2 - 1) - 1; for (int i = startRow; i < startRow + row; i++) { for (int j = startCol; j < startCol + col; j++) { array[i,j] = ""; } }