| 以下是引用片段: catch (Exception ex) { Console.WriteLine(ex.Message); } } public void display() { for (int i = 0; i < this.mines.GetLength(0); i++) { for (int j = 0; j < this.mines.GetLength(1); j++) { Console.Write(this.mines[i, j] + " "); } Console.Write("n"); } } public void SaveTxt() { StreamWriter sw = new StreamWriter(@"c:abc.txt"); for (int i = 0; i < this.mines.GetLength(0); i++) { for (int j = 0; j < this.mines.GetLength(1); j++) { sw.Write(this.mines[i, j] + " "); } sw.WriteLine(); } sw.Flush(); sw.Close(); } } } |