版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/frozleaf/article/details/88230108
在DebugView中显示信息,有四种方法:
[System.Runtime.InteropServices.DllImport("kernel32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
public static extern void OutputDebugString(string message);
Trace.Write("c# Trace");
Debug.Write("c# Debug");
Debugger.Log(0, null, "c# debugger");
OutputDebugString("c# OutputDebugString");
注意:
- 必须在非调试模式下,DebugView中才会显示
- Debug和Trace两种方式,必须勾选相应的宏,如下:
效果如下: