views:

65

answers:

2

I found lots of samples how to redirect console output into a file. However I need an opposite soluiton - I have StreamWriter which I want to be shown in the Console output once I do sw.WriteLine("text");

+1  A: 

Use Console.Out.

Quartermeister
+6  A: 

Just point the stream to standard output:

sw = new StreamWriter(Console.OpenStandardOutput());
sw.AutoFlush = true;
Console.SetOut(sw);
John Feminella