Reputation: 622
Disclaimer: I come from a C++ background and started C# recently.
For some reason, I cannot write to the console's standard output like this:
new StreamWriter(Console.OpenStandardOutput()).Write("Stackoverflow");
Any suggestions?
Upvotes: 0
Views: 1974
Reputation: 459
sw = new StreamWriter(Console.OpenStandardOutput());
sw.AutoFlush = true;
Console.SetOut(sw);
sw.WriteLine("Stackoverflow");
Upvotes: 4