Calling Trace class executes in both debug and release build type, while using Debug only execute in debug mode.
So the following code in Debug and Release build type has different output:
using System;
using System.Diagnostics;
Debug.Listeners.Add(new ConsoleTraceListener());
Debug.AutoFlush = true;
Debug.WriteLine("This is Debug");
Trace.WriteLine("This is Trace");
Console.WriteLine("This is Console");
In Debug build type, output is:
This is Debug
This is Trace
This is Console
In Release build type, output is
This is Debug
This is Console
No comments:
Post a Comment