用foreach遍历二维数组
static void Main(string[] args) { object[,] dataArray = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; int count = 0; foreach (object item in dataArray) { Console.Write(item); Console.Write(" "); count++; if (count % dataArray.GetLength(1) == 0) { Console.WriteLine(); } } }