Trace vs Debug in .NET BCL

后端 未结 7 1290
余生分开走
余生分开走 2020-12-02 11:58

It seems that the

  • System.Diagnostics.Debug, and
  • System.Diagnostics.Trace

are largely the same, with the notable exception that

7条回答
  •  一生所求
    2020-12-02 12:35

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

    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.

    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.

    Hope this helps.

提交回复
热议问题