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?
At the simplest level, they have different compilation switches – i.e.
Debug.WriteLineetc is only toggled if you have theDEBUGcompilation symbol (not common for release builds), where-asTrace.WriteLinewill usually be included even in release builds.The
Traceroute has customizable trace-listeners, that can be plumbed in via configuration;Debuggenerally goes to a debugger as the listener. Of course, there are 3rd-party trace systems that offer much more flexibility.