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

编程入门 行业动态 更新时间:2024-10-24 01:48:29
本文介绍了Console.writeline()/trace.writeline()之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

推荐答案

从 调试角度查看这些内容。

Look at these from the "Debugging" perspective.

  • 我们开始使用 Console.WriteLine()
  • $ b进行调试$ b
  • 后来我们知道总是在控制台上打印调试数据可能不好。我们甚至可能没有控制台。然后我们开始使用 Debug.WriteLine(),它将在Visual Studio输出窗口上打印我的调试信息。
  • 然后我们知道了我们不应该在发布模式下打印所有调试信息,因此我们应该在发布模式下使用 Trace.WriteLine()。在调试模式下,我们可以看到 Debug.WriteLine()和 Trace.WriteLine()的输出。
  • 这里是一个很好的参考:跟踪和调试的使用
  • We started debugging using Console.WriteLine()
  • Later we got to know it might not be good to print debugging data on console always. We might not even have a console. Then we started using Debug.WriteLine(), which prints my debug information on Visual Studio output window.
  • Then we got to know that we shouldn't print all debug information in release mode, so we should use Trace.WriteLine() in release mode. In debug mode we can see outputs from both Debug.WriteLine() and Trace.WriteLine().
  • Here's a very good reference: Usage of Trace and Debug

在同一应用程序中分别使用 Trace 和 Debug 类。在调试解决方案配置项目中,跟踪和 Debug 输出均处于活动状态。该项目将从这两个类生成输出到所有 Listener 对象。但是,发布解决方案配置项目仅从 Trace 类生成输出。 发布解决方案配置项目将忽略任何 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."

以下是一些与您相关的项目可能会发现有用:

Here are some relevant items that you might find useful:

  • 在哪里查找跟踪日志?
  • 如何设置调试或发布配置?
  • 了解构建配置。
  • Where to look for trace logs ?
  • How to set Debug or Release Configurations ?
  • Understanding build configurations.

更多推荐

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

本文发布于:2023-05-28 12:29:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/320915.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:区别   Console   writeline   trace

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!