Q:

Trace and Debug statements

Im a little confused over how to use the .NET Trace and Debug classes.
Why would you bother using Trace instead of Debug?
Trace.TraceError()
Trace.TraceInformation()
Trace.Assert()

Debug.WriteLine()
Debug.Assert()

Also, I understand that Debug statements are ignored when your in Release config mode, but If trace statements apply all the time, how does this affect performance?

A:

At the simplest level, they have different compilation switches - i.e. Debug.WriteLine etc is only toggled if you have the DEBUG compilation symbol (not common for release builds), where-as Trace.WriteLine will usually be included even in release builds.
The Trace route has customizable trace-listeners, that can be plumbed in via configuration; Debug generally goes to a debugger as the listener. Of course, there are 3rd-party trace systems that offer much more flexibility.

