Redirect Console.Write... Methods to Visual Studio's Output Window While Debugging
Change application type to Windows before debugging. Without Console window, Console.WriteLine works like Trace.WriteLine. Don't forget to reset application back to Console type after debugging.
class DebugWriter : TextWriter
{
public override void WriteLine(string value)
{
Debug.WriteLine(value);
base.WriteLine(value);
}
public override void Write(string value)
{
Debug.Write(value);
base.Write(value);
}
public override Encoding Encoding
{
get { return Encoding.Unicode; }
}
}
class Program
{
static void Main(string[] args)
{
#if DEBUG
if (Debugger.IsAttached)
Console.SetOut(new DebugWriter());
#endif
Console.WriteLine("hi");
}
}
** note that this is roughed together almost pseudo code. it works but needs work :) **
You can change it to System.Diagnostics.Debug.Write();