I have a 2-Dimensional array and a loop that prints all of the elements in the array using Console.Write and Console.WriteLine. However, the command line does not show all of the elements of the array. I tried debugging by also printing the output to a text file. When I look at the text file I see that it contains part of the expected output and the command line contains the other part of the expected output with a few overlaps. Does anyone know a possible solution to this problem?
public void Print()
{
TextWriter tw = new StreamWriter("output.txt");
//Prints the accessed coordinates and how many times it was accessed
for(int i = 0; i < 20; i++)
{
for(int j = 0; j < 25; j++)
{
Console.Write("Coordinate " + grid[i, j].getCoordinates() + ": ");
Console.WriteLine(grid[i, j].getAccessed());
string text = "Coordinate " + grid[i,j].getCoordinates() + ": " + grid[i,j].getAccessed() + "";
tw.WriteLine(text);
}
}
}
I think you are exceeding how many lines the console can display.
Try this:
Console.BufferHeight = 500;