Anyone knows the difference between System.Diagnostic.Trace
and System.Diagnostic.TraceSource
classes?
I've been using Trace for most of my projects and I just happen to found out about TraceSource
the other day. They seems to offer similar API, is one better than the other?
TraceSource is the newer version (since .NET 2) and Trace is the older version, more info is available here:
TraceSource allows you to enhance the granularity over your tracing : in your config file you can enable/disable only the tracesource you want at the level you want (information, warning, error, ...) You can find really good explanation here : http://www.codeproject.com/Articles/149251/Debugging-Tracing-and-Instrumentation-in-NET-and-A
来源:https://stackoverflow.com/questions/1101174/difference-between-using-trace-and-tracesource