Reputation: 158
I'm wondering if its possible to change the size of the consoles buffer, as the included Console.SetBufferSize function will not allow you to shrink the buffer. bonus points if I don't need a external library.
Upvotes: 0
Views: 482
Reputation: 784
According to the MSDN documentation of Console.SetBufferSize it is not limited to growing the buffer. However you have to adjust the console window size before shrinking the buffer.
This example works:
Console.WriteLine($"Current buffer size: {Console.BufferWidth}x{Console.BufferHeight}");
Console.SetWindowSize(1, 1);
Console.SetBufferSize(80, 80);
Console.SetWindowSize(40, 20);
Console.WriteLine($"New buffer size: {Console.BufferWidth}x{Console.BufferHeight}");
Output:
Current buffer size: 120x9001
New buffer size: 80x80
Upvotes: 1