Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In .NET the idiom <code>Environment.NewLine</code> is a <code>System.String</code> that consists of the proper <code>System.Char</code>(s) to terminate a line of text, so:</p> <pre><code>System.Diagnostics.Debugger.Log(0, null, t[0] + Environment.NewLine); </code></pre> <hr> <p><sup><i>[Updated 2015-05-07]</i></sup><br/></p> <p>Reflecting upon this a few years on, i feel like i dropped the ball on this at least a little bit (though, i <em>do</em> think that it's important to be able to do the low-level NewLine without having to fight the language sometimes as well; so i also like the original answer...)</p> <p>First off, David Brown did give a good answer below: using <code>System.Diagnostics.Debug.WriteLine</code> (and <code>Write</code>) instead. That <em>is</em> a good solution to this, especially in the case of the OP, as the other parameters of the call aren't even really being used; and the <code>Debug.Write</code>/<code>WriteLine</code> calls looks like this (using for examples the OP's original calls, assuming for the sake of example that the OP's original first parameter <code>responseFromServer</code> was already terminated, and the second needed termination):</p> <pre><code>System.Diagnostics.Debug.Write(responseFromServer); System.Diagnostics.Debug.WriteLine(t[0]); </code></pre> <p>Easy peasy. </p> <p>Better yet though, why not <code>Trace</code>? </p> <p>I will just point you to <a href="https://stackoverflow.com/questions/198322/redirect-trace-output-to-console">this stackoverflow question here</a> but here's the gist.</p> <p><a href="https://msdn.microsoft.com/en-us/library/sk36c28t%28v=vs.100%29.aspx" rel="nofollow noreferrer">You can set up in your App.config but, of course you can also just create it all programatically as well, since the app.config sections simply create objects!</a> </p> <p>Something like:</p> <pre> ⋮ &lt;trace&gt; &lt;!-- note: notional notation only --> &lt;add name="consoleLog" logLevel="debug" enabled="" type="⋯ &lt;add name="netLog" logLevel="verbose" enabled="false" addr="rdp://127.0.0.1:1935/nothing/stream" type="⋯ &lt;add name="fileLog" logLevel="errors" enabled="true" file="c:\boots.ini" type="⋯ &lt;/trace&gt; ⋮ </pre> <p>and then your code calls <code>Trace()</code> just like <code>Debug()</code>.</p> <pre><code>System.Diagnostics.Trace.Write(responseFromServer); System.Diagnostics.Trace.WriteLine(t[0]); </code></pre> <p>Yep, it's multi-target; and you can set it up to be multi-target, and you can either use built-in <code>System.Diagnostics</code> <code>Trace</code> types (like a <code>Console</code> tracer if you want to print to the screen, for example) or you can create your own custom types as necessary. Beautiful!</p> <p>Last word: both Debug and Trace have lots of helper functions that are there to make whatever writes you're doing more symbolic; WriteLineIf, TraceError, etc. and it pays to play around with them until you figure out why they are there. It's <em>almost</em> guaranteed that the more you <em>use</em> them, the more <em>useful</em> you will find them. ♡</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload