Output debug information written in C # code - Debug class using C # C # two methods debug tracing and debugging programs -Debug class uses C # class debugging

 

A: The two kinds of debug methods in C #

 

Article: C # trace and debug programs using the class -Debug

Very comprehensive article, you can learn under the careful use.

 

Article: C # Debug class

He did not look carefully.

 

Keywords: Debug class and the Trace class What is the difference?

 

Microsoft Information: https: //docs.microsoft.com/zh-cn/dotnet/api/system.diagnostics.debug redirectedfrom = MSDN & view = netframework-4.8?

Title: Debug Class

Action class: providing a set of methods and properties useful for debugging code.

Sample code:

// Specify /d:DEBUG when compiling.

using System;
using System.Data;
using System.Diagnostics;

class Test
{
    static void Main()
    {
       Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));
       Debug.AutoFlush = true;
       Debug.Indent();
       Debug.WriteLine("Entering Main");
       Console.WriteLine("Hello World.");
       Debug.WriteLine("Exiting Main"); 
       Debug.Unindent();
    }
}

Details need to see Microsoft's Web site.

 

Guess you like

Origin www.cnblogs.com/Tpf386/p/11465049.html