Zookeeper
The two tasks must be completed by the Debugger class. The System. Diagnostics. Debugger type allows us to interact with the Debugger. It is easy to understand that there are not many members of the Debugger type. (MSDN)
First, you must use the IsAttached attribute to determine whether the current process has attached a debugger. If so, use the IsLogging method to determine whether the current append debugger supports logging. If both are true, you can use the Log method to record messages safely. The Log Content is displayed in the Visual Studio output window.
The Debugger. Break method forces the Debugger to perform breakpoint processing when running the current code.
Code:
// + Using System. diagnostics; // determine whether to append the Debugger. // determine whether the Debugger supports the Message Log if (Debugger. isAttached & Debugger. isLogging () {// record Debugger. log (1, "joke", "This code must be well debugged! "); // Add the breakpoint Debugger. Break ();}
Debug and run the above Code (you can directly press F5). Visual Studio will debug the breakpoint on the Debugger. Break () line of code, and the output window will have our custom information, such: