跟踪调试VS .NET中的BCLVS、NET、BCL

由网友(情话信使)分享简介:看来,System.Diagnostics.Debug,和System.Diagnostics.Trace 基本上是相同的,显着的例外是调试的用法是编出来的一个发布配置。 are largely the same, with the notable exception that Debug usage is comp...

看来,

System.Diagnostics.Debug,和 System.Diagnostics.Trace

基本上是相同的,显着的例外是调试的用法是编出来的一个发布配置。

are largely the same, with the notable exception that Debug usage is compiled out in a release configuration.

当你会用一个而不是其他?这个我已经挖了迄今为止唯一的答案就是你使用调试类生成的输出,你只能看到在调试配置,和跟踪将保持在一个版本的配置,但并没有真正回答我的脑袋的问题。

When would you use one and not the other? The only answer to this I've dug up so far is just that you use the Debug class to generate output that you only see in debug configuration, and Trace will remain in a release configuration, but that doesn't really answer the question in my head.

如果你要测试您的code,为什么你会永远使用调试,因为跟踪可以关闭不用重新编译?

If you're going to instrument your code, why would you ever use Debug, since Trace can be turned off without a recompile?

推荐答案

的主要区别是一个你表明:调试不包括在释放,而Trace是

The main difference is the one you indicate: Debug is not included in release, while Trace is.

预期的差,按我的理解是,开发团队可以使用调试发射,这可能是过于详细(或暴露)的产品的消费者(S)丰富的,描述性的消息,而跟踪的目的是放出该类型的消息被朝检测应用程序更专门面向。

The intended difference, as I understand it, is that development teams might use Debug to emit rich, descriptive messages that might prove too detailed (or revealing) for the consumer(s) of a product, while Trace is intended to emit the kinds of messages that are more specifically geared toward instrumenting an application.

要回答你的最后一个问题,我想不出一个理由使用调试仪器一块code我打算放人。

To answer your last question, I can't think of a reason to use Debug to instrument a piece of code I intended to release.

希望这有助于。

阅读全文

相关推荐

最新文章