In .NET, idiom Environment.NewLine is a System.String consisting of the correct System.Char (s) to complete a line of text, therefore:
System.Diagnostics.Debugger.Log(0, null, t[0] + Environment.NewLine);
[Updated on 2015-05-07]
Reflecting on this a few years later, I feel that I have at least kicked the ball a bit about this (although I think it is important to be able to make a low-level NewLine without having to deal with the language sometimes as well, so I also like the original answer. ..)
First, David Brown gave a good answer below: Use System.Diagnostics.Debug.WriteLine (and Write ) instead. This is a good solution for this, especially in the case of OP, since other call parameters are not even used; and the Debug.Write / WriteLine calls look like this (using the original OP calls as an example, assuming for the example that the initial first OP parameter responseFromServer was already completed, and the second is completion):
System.Diagnostics.Debug.Write(responseFromServer); System.Diagnostics.Debug.WriteLine(t[0]);
Easy peasy.
Better yet, but why not Trace ?
I'll just point you to fooobar.com/questions/79231 / ... , but here's the gist.
You can configure it in your App.config, but, of course, you can also just create it all programmatically, since sections of app.config just create objects!
Sort of:
โฎ
<trace>
<! - note: notional notation only ->
<add name = "consoleLog" logLevel = "debug" enabled = "" type = "โฏ
<add name = "netLog" logLevel = "verbose" enabled = "false" addr = "rdp: //127.0.0.1: 1935 / nothing / stream" type = "โฏ
<add name = "fileLog" logLevel = "errors" enabled = "true" file = "c: \ boots.ini" type = "โฏ
</trace>
โฎ
and then your code calls Trace() just like Debug() .
System.Diagnostics.Trace.Write(responseFromServer); System.Diagnostics.Trace.WriteLine(t[0]);
Yes, it is multi-purpose; and you can configure it as multi-purpose, and you can use the built-in System.Diagnostics Trace types (for example, the Console tracer, if you want to print on the screen, for example), or you can create your own custom types if necessary. Beautiful!
Last word: Debug and Trace have many helper functions that are there to make everything that you write, you make more symbolic; WriteLineIf, TraceError, etc., And you pay to play with them until you find out why they are there. It almost guaranteed that the more you use them, the more useful you will find them. โก