console - Console.writeline()/trace.writeline() 之间的区别

标签 console trace

Console.WriteLine() 和有什么区别和Trace.WriteLine()

最佳答案

从“调试”的角度来看这些。

  • 我们开始使用 Console.WriteLine() 进行调试
  • 后来我们知道总是在控制台上打印调试数据可能并不好。我们甚至可能没有控制台。然后我们开始使用 Debug.WriteLine(),它在 Visual Studio 输出窗口上打印我的调试信息。
  • 然后我们知道我们不应该在 Release模式下打印所有调试信息,因此我们应该在 Release模式下使用 Trace.WriteLine() 。在 Debug模式下,我们可以看到 Debug.WriteLine()Trace.WriteLine() 的输出。
  • 这里有一个非常好的引用:Usage of Trace and Debug

You can use the Trace and the Debug classes separately or together in the same application. In a Debug Solution Configuration project, both Trace and Debug output are active. The project generates output from both of these classes to all Listener objects. However, a Release Solution Configuration project only generates output from a Trace class. The Release Solution Configuration project ignores any Debug class method invocations."

以下是一些您可能会觉得有用的相关项目:

关于console - Console.writeline()/trace.writeline() 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42548412/

相关文章:

java - 在Java应用程序中执行系统命令

c++ - Windows Vista/7 中的控制台/命令提示符全屏

javascript - 控制台访问 $(document).ready 函数本地的 Javascript 变量

jquery - 两次调用 .each() 之间 'this' 会发生什么?

c# - 跟踪所有进程的 Windows API 调用

c++ - 如何在 Windows 上正确地将拉丁字符打印到 C++ 控制台?

actionscript-3 - 记录 flex/actionscript 的注入(inject)?

Javascript:跟踪自定义事件

C#:最佳实践 Debug.Print

c# - 具有并行任务时检测网页的最佳实践