简体   繁体   English

Debug.WriteLine(“Hello World!”) - 没有出现在 output 中

[英]Debug.WriteLine(“Hello World!”) - Does not appear in the output

Problem问题

I am developing a UWP ( Universal Windows Platform ) application and as a test I included the我正在开发一个UWP通用 Windows 平台)应用程序,作为测试我包括

Debug.WriteLine("Hello World;"); method, but in the output the text entered in the method was not displayed.方法,但在 output 中,方法中输入的文本未显示。

Question问题

Was the method incorrectly integrated into the UWP application by me?该方法是否被我错误地集成到 UWP 应用程序中?

Source Code源代码

using System;
using System.Diagnostics;
using Windows.System;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml.Controls;

// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409

namespace UwpApplication1
{
    /// <summary>
    ///     An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            
            Debug.WriteLine("Hello World! - Debug.Writeline() Test");

        }
    }
}

If you want ' Hello, World ' to be shown in the Visual Studio output and not the UWP Application, You just write Console.WriteLine() instead of Debug.WriteLine() .如果您希望在 Visual Studio output 而不是 UWP 应用程序中显示“ Hello, World ”,您只需编写Console.WriteLine()而不是Debug.WriteLine()

If you want to it to be shown in the UWP Application, you create a text block (without code).如果您希望它显示在 UWP 应用程序中,您可以创建一个文本块(无代码)。 Writing 'Hello, World!" in the debug will just show a comment in the output that cannot be seen by the user in the actual app.在调试中写入“Hello, World!”只会在 output 中显示用户在实际应用中看不到的注释。

If you want a console output just type in Console.WriteLine() .如果你想要一个控制台 output 只需输入Console.WriteLine()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM