Displaying multiple lines of text in a console application?

I need a way to show multiple lines of text (like 1000 lines) in a console application and be able to scroll through all lines. However, when I do something like the code snippet below, I can only see the last 100 or so lines in the console.

for (int i = 1; i <= 1000; i++)
{
   Console.WriteLine(i.ToString());
}

      

In the beginning I wanted to show the line cartridge (for example, 100 at a time), and let the user click further, but I was hoping there was an easier and more convenient way?

+2


source to share


1 answer


If you want more control over the number of lines scrolled in the console, you can adjust the Console.BufferHeight property much more. The value is the number of lines that are displayed. So if you set it to the number of lines and assume that none of them are wrapped, your output will scroll.



+6


source







All Articles