使用 Eclipse 在 Java 中执行控制台应用程序时,我看到输出被放在 IDE 本身的文本框中,而不是像在 Visual Studio 中那样弹出控制台.这很方便,因为即使在程序退出后,我仍然可以很好地利用其中写入的文本,因为在我再次运行它之前它不会被删除.是否可以使用 Visual Studio 实现类似的目标?我知道而不是这样做
When doing a console application in Java with Eclipse, I see the output being put in a text box in the IDE itself, instead of having a console popping up like in Visual Studio. This comes in handy, as even after the program has exited, I can still make good use of the text that was written in it, as it doesn't get erased until I run it again. Is it possible to achieve anything like that with Visual Studio? I know that instead of doing
System.Console.WriteLine(str);
我可以的
System.Diagnostics.Debug.WriteLine(str);
但这并不完全相同,因为您在输出窗口中会看到很多垃圾",就像所有加载的符号等一样.
but it is not quite the same thing, as you get a lot of "junk" in the Output window, as all the loaded symbols and such.
更好的是,当您运行应用程序时,是否可以在 IDE 本身中完成所有操作,而不是让控制台运行?
Even better, is it possible to have everything done in the IDE itself, when you run your application, instead of having the console running?
在工具 -> Visual Studio 选项对话框 -> 调试 -> 勾选将所有输出窗口文本重定向到即时窗口".
In the Tools -> Visual Studio Options Dialog -> Debugging -> Check the "Redirect All Output Window Text to the Immediate Window".
这篇关于在 Visual Studio 中而不是控制台中具有控制台应用程序的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!