相关疑难解决方法(0)

System.Diagnostics.Debug.Write输出出现在哪里?

以下C#程序(内置csc hello.cs)仅Hello via Console!在控制台和Hello via OutputDebugStringDebugView窗口中打印.但是,我看不到任何一个System.Diagnostics.*电话.这是为什么?

using System;
using System.Runtime.InteropServices;
class Hello {
    [DllImport("kernel32.dll", CharSet=CharSet.Auto)]
    public static extern void OutputDebugString(string message);

    static void Main() {
        Console.Write( "Hello via Console!" );
        System.Diagnostics.Debug.Write( "Hello via Debug!" );
        System.Diagnostics.Trace.Write( "Hello via Trace!" );
        OutputDebugString( "Hello via OutputDebugString" );
    }
}
Run Code Online (Sandbox Code Playgroud)

是否需要一些特殊的命令行开关csc

我没有使用Visual Studio进行任何开发,这是纯粹的命令行.

c# debugging

138
推荐指数
6
解决办法
18万
查看次数

如何在Windows 10上的UWP中输出到控制台?

有没有办法写入控制台/命令提示符/ powershell(如Console.WriteLine())或UWP应用程序中的类似内容?

如果控制台不可用,那么我可以使用一个合适的替代方法来向屏幕写入大量文本吗?

当然,我可以对它进行XAML控制并输出,但与简单相比,它似乎并不方便Console.WriteLine().

关于WPF控制台也有很老的讨论,但似乎没有任何工作(至少,我找不到Project-Properties-Application tab-Output Type-Console Application并且Trace.WriteLine("text")不可用).

c# console xaml windows-10 uwp

43
推荐指数
1
解决办法
4万
查看次数

标签 统计

c# ×2

console ×1

debugging ×1

uwp ×1

windows-10 ×1

xaml ×1