This article is a mirror article of machine translation, please click here to jump to the original article.

View: 20154|Reply: 1

[Source] C# DEBUG debug information printing and output detailed explanation

[Copy link]
Posted on 6/1/2018 11:04:45 AM | | |
1. Debug is only executed in [debug mode] (the drop-down box behind the run button is optional)  


2.debug provides many debug instructions such as assertions   
      System.Diagnostics.Debug.Assert(false, "info");   
      A dialog box appears  


3.debug can customize the listener   
  (The following example saves the information to a disk file)   
  System.Diagnostics.TextWriterTraceListener   t=new   System.Diagnostics.TextWriterTraceListener(@"c:/a.txt");   
  System.Diagnostics.Debug.Listeners.Add(t);   
  System.Diagnostics.Debug.WriteLine("Information");   
  t.Flush();


4. What is the difference between debug and console.write()?

   debug output to the IDE's time-limited window while running state (for Windows Forms programs)   
   console.write is used for console programs, which can output information to the console (the one in the DOS interface) at runtime   

  Both are inputs, but Debug is output to the output window, and Console is output to the control panel window.   
  And Debug must be effective in the Debug case, you will see the output of the Console after pressing Ctrl+F5.   
  After pressing F5, you can also see the output of the Console, and you can also see the output of Debug in the output




Previous:The difference between ManualResetEvent and AutoResetEvent learned by C# threads
Next:Authentication errors occur, which may be due to the CredSSP encryption Oracle fix
Posted on 6/1/2018 5:20:49 PM |
Very useful, collected.
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com