Is there a TextWriter interface to the System.Diagnostics.Debug class?
- by John Källén
I'm often frustrated by the System.Diagnostics.Debug.Write/WriteLine methods. I would like to use the Write/WriteLine methods familiar from the TextWriter class, so I often write
Debug.WriteLine("# entries {0} for connection {1}", countOfEntries, connection);
which causes a compiler error. I end up writing
Debug.WriteLine(string.Format("# entries {0} for connection {1}",
countOfEntries, connection));
which is really awkward.
Does the CLR have a class deriving from TextWriter that "wraps" System.Debug, or should I roll my own?