如何在Windows 10的UWP中输出到控制台? [英] How to output to console in UWP on Windows 10?

查看:382
本文介绍了如何在Windows 10的UWP中输出到控制台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在UWP应用程序中写入控制台/命令提示符/ powershell(例如 Console.WriteLine())或类似的东西?

Is there a way to write to console / command prompt / powershell (like Console.WriteLine()) or anything similar in UWP apps?

如果没有控制台,我可以使用适当的替代方法在屏幕上写入大量文本吗?

If console is unavailable is there a proper alternative that I can use instead to write to the screen large amounts of text?

我,当然,可以制作XAML控件并将其输出,但是与简单的 Console.WriteLine()相比,它似乎并不方便。

I, of course, can make a XAML control and output to it, but it doesn't seem to be convenient in comparison to simple Console.WriteLine().

WPF控制台,但似乎没有任何作用(至少,我找不到 Project-Properties-Application选项卡-Output Type-Console Application Trace.WriteLine( text)不可用)。

There is also very old discussion on WPF console, but nothing seems to work from there (at least, I couldn't find Project-Properties-Application tab-Output Type-Console Application and Trace.WriteLine("text") is unavailable).

推荐答案

您可以从System.Diagnostics命名空间使用Debug.WriteLine方法

You can use Debug.WriteLine method from System.Diagnostics namespace

MSDN链接

开始时调试您的应用程序时,这些消息将显示在输出窗口中(标准VS快捷键为Ctrl + Alt + O, ReSharper 快捷键是Ctrl + W,O)

When you start debugging your application those messages will be displayed in the Output Window (Standard VS shortcut is Ctrl+Alt+O, ReSharper shortcut is Ctrl+W, O)

这篇关于如何在Windows 10的UWP中输出到控制台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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