title: How to convert string or character to 'escaped representation'?
body: <p>Given this sample code:</p>
  
  <pre><code>var s = "abc\r\ndef";
  foreach (var c in s)
  {
      Console.WriteLine($"Current char: {c}");
  }
  </code></pre>
  
  <p>Of course, the <code>'\r'</code> and <code>'\n'</code> characters, are written as whitespace and an actual newline, respectively. What I want to achieve is to write <code>'\r'</code>, <code>'\n'</code> instead.</p>
  
  <p>What's the easiest way to convert a character to it's (C#) 'escaped representation'? Should I look at Roslyn for this, or is there a simple conversion function available?</p>