(Console.BufferHeight)我看不出/滚动查看所有为Console.WriteLine控制台输出 [英] (Console.BufferHeight) I can't see/scroll to see all the console output with Console.WriteLine
问题描述
当我运行此code,在输出窗口的顶部数为99701.为什么我能看到所有的方式通过1?事实上,我看到所有的数字得到输出,但在控制台窗口中,我只能SCROLL足够高看99701(我猜)。我使用的是Vista家庭的Visual C#EX preSS。 :D
When I run this code, the number at the top of the output window is 99701. Why don't I get to see all the way through 1? I actually see all the numbers getting outputted, but on the console window, I can only SCROLL high enough to see 99701 (I'm guessing). I'm using Visual C# express on Vista Home. :D
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using utilities;
namespace Testing_Project {
class Program {
static void Main(string[] args) {
List<string> myList = new List<string>();
for (int x = 0; x < 100000; x++)
myList.Add( x.ToString() );
foreach (string s in myList) {
Console.WriteLine(s);
}
Console.Read();
}
}
}
Console.Write(S)的确不错,但Console.Write(S +\ N)没有。我猜我只能通过这么多的新行向上滚动?
Console.Write(s) does fine, but Console.Write( s+"\n") does not. I'm guessing I can only scroll up through so many newlines?
推荐答案
从.NET Framework 2.0和超越,你可以从自己的程序中使用<一个改变缓冲高度href="http://msdn.microsoft.com/en-us/library/system.console.bufferheight.aspx">Console.BufferHeight:
From .Net Framework 2.0 and beyond, you can change the buffer height from within your own program with Console.BufferHeight:
Console.BufferHeight = Int16.MaxValue - 1; // ***** Alters the BufferHeight *****
List<string> myList = new List<string>();
for (int x = 0; x < 100000; x++)
myList.Add(x.ToString());
foreach (string s in myList) {
Console.WriteLine(s);
}
,最大高度是Int16.MaxValue - 1
The maximum height is Int16.MaxValue - 1.
这篇关于(Console.BufferHeight)我看不出/滚动查看所有为Console.WriteLine控制台输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!