写入VisualStudio的调试控制台

写入VisualStudio的调试控制台

问题描述:

嗨专家,



我想将一些文本打印到Visual Studio内置调试控制台。为此,我使用以下代码:

Hi experts,

I'd like to print some text to the Visual Studio built-in debug console. For that I use the following code:

Console.Write("Printing my text here.");

现在我想用写作$ c覆盖打印 $ c>:

Now I would like to overwrite "Printing" with "Writing ":

Console.Write("\rWriting ");

但回车单独换行。



如何在Visual Studio的新行开头继续写入输出窗口?



Console.SetCursorPosition 导致无效句柄IOException。

Console.Write(\ b); 在黑色背景上打印一个白色圆圈。

But the carriage return does a newline on its own.

How can I continue writing at the beginning of the new line in Visual Studio's output window?

Console.SetCursorPosition causes an "Invalid handle" IOException.
Console.Write("\b"); prints a white circle on black background.

你不能,AFAIK - 它不适合正常的控制台活动和互动。相反,构建一个包含要输出的数据的字符串(或StringBuilder),修改它,然后使用Console.Write
You can't, AFAIK - it's not meant for "normal" console activity and interaction. Instead, build a string (or StringBuilder) containing the data you want to output, modify that, and then use Console.Write