写入VisualStudio的调试控制台 [英] Writing to VisualStudio's debug console

查看:197
本文介绍了写入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>:

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


这篇关于写入VisualStudio的调试控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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