public static string[,] Remove(string[,] arr, int index)
//index是从0开始计算的,所以假设删除3行3列,index应传入2
{
string[,] arrStr = new string[arr.GetLength(0) - 1, arr.GetLength(1) - 1];
int row = 0;
int col = 0;
for (int i = 0; i < arr.GetLength(0); i++)
{
if (i == index)
{
continue;
}
col = 0;
for (int j = 0; j < arr.GetLength(1); j++)
{
if (j == index)
{
continue;
}
arrStr[row, col] = arr[i, j];
col++;
}
row++;
}
return arrStr;
}