int[,] arrayA = new int[3, 3]{
{1,2,3},
{4,5,6},
{7,8,9}
};
int[,] arrayB = new int[3, 3]{
{1,2,3},
{4,5,6},
{7,8,9}
};
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
Console.Write(arrayA[i,j]+" ");
}
Console.WriteLine();
}
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
arrayA[i, j] = arrayB[j, i];
//就是把横纵的下标换个位置
}
}
Console.WriteLine();
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
Console.Write(arrayA[i, j] + " ");
}
Console.WriteLine();
}
Console.ReadKey();
温馨提示:答案为网友推荐,仅供参考