如果我有执行每第二个Console.WriteLine多次,并且程序左运行的很长一段时间的程序,可以与太多行控制台溢出?我只是想知道,如果它最终将抛出一个IO异常,或者Console.Writelines的数量实际上是无限的。
If I have a program that performs Console.Writeline multiple times per second, and the program is left running for a long period of time, can the console overflow with too many lines? I just want to know if it will eventually throw an IO exception or if number of Console.Writelines is virtually infinite.
推荐答案没有,它不会溢出。如果检查的选项的选项卡的快捷方式,命令窗口,你会看到一个的缓冲区大小的选项。这指定了将被存储的行的最大数量。旧的被删除。
No, it won't overflow. If you check the Options tab for a shortcut to the command window you will see a buffer size option. This specifies the maximum number of lines that will be stored. Older ones get deleted.
正如Scott指出在下面他的意见,您可以访问使用从您的代码此设置的 Console.BufferHeight 。它的默认值(当我在我的开发PC上测试)是的 300 。最大允许值为 32766 ( Int16.MaxValue - 1 )。
As Scott suggests in his comment below, you can access this setting from your code using Console.BufferHeight. The default value for this (when I tested on my development PC) is 300. The maximum allowed value is 32766 (Int16.MaxValue - 1).
更多推荐
C#可将中控台溢出太多Writelines?
发布评论