The reaseon is:
if you look at the Console class in Reflector, you'll find that if a process doesn't have an associated console, Console.Out and Console.Error are backed by Stream.Null (wrapped inside a TextWriter), which is a dummy implementation of Stream that basically ignores all input, and gives no output.
The alternative to Console.WriteLine is System.Diagnostics.Debug.WriteLine()
If you use System.Diagnostics.Debug.WriteLine() instead of Console.WriteLine(), then you can see the results in the Output window of Visual Studio.
No comments:
Post a Comment