Quite often, I come across elements in the .NET platform that have few or no code examples on how to use functions. In other cases, there are many examples, but none of them seem to work as prescribed.
Example: class System.Diagnostics.ConsoleTraceListener.
From all that I read, and every example code that I saw when I do something like the following:
ConsoleTraceListner listener = new ConsoleTraceListener();
listener.WriteLine("Yo");
... I should see a console window with "Yo". However, instead of the expected output, it writes "Yo" to the output of Visual Studio, where you can see the usual Trace / Debug messages.
I tried every iteration of the examples that I searched for Googled, including setting up the configuration file for the corresponding listener, adding the listener to the Trace.Listeners collection, custom ConsoleTraceListener types, etc. I even just compiled the version and ran the executable (which does absolutely nothing).
What am I missing?
source
share