Debug log anywhere

For an application, Log essential, but sometimes only want to see lower output, plus log, then if it is too much trouble, this time used the Debug.WriteLine (under "test, hello, great, cattle fork! "); Debug code does not actually executed in release mode, thanks to the conditional compilation [Conditional (" DEBUG ")], if you want to also log in release mode, then you can use Trace. Trace also provides a variety of methods can be recorded Information, Error, etc., after the switch to the Debug Console, the console but not the output message, this is because the Debug output window.

namespace ConsoleTest 
{ 
    class Program 
    { 
        static  void the Main ( String [] args) 
        { 
            Console.WriteLine ( " the Hello World " ); 
            Debug.WriteLine ( " test, hello, great, cattle fork! " ); 
            Console.Read ( ); 
        } 
    } 
}

Figure:

 

Guess you like

Origin www.cnblogs.com/zhao123/p/10956069.html