C#可将中控台溢出太多Writelines? [英] C# Can the Console overflow with too many Writelines?

查看:209
本文介绍了C#可将中控台溢出太多Writelines?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有执行每第二个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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆