title: c# hex byte 0x09 (ascii -> tab) to "\t" string
body: <p>I need to convert a byte array of a text file to it's string character representation. </p>
  
  <p>For example, if I have a text file that has:</p>
  
  <p>hello (tab) there (newline) friend</p>
  
  <p>I would like to convert that to an array:</p>
  
  <pre><code>my_array  = {'h', 'e' ,'l','l','o', '\t', 't', 'h','e','r','e', '\r','\n', 'f', 'r' ,'i','e','n', 'd'};
  </code></pre>
  
  <p>I'm having trouble with converting the control characters to their escaped strings, i.e.:</p>
  
  <blockquote>
    <ul>
    <li>0x09 = '\t'; </li>
    <li>0x0D = '\r';</li>
    <li>0x0A = '\n';</li>
    </ul>
  </blockquote>
  
  <p>I have tried this, but the tabs and new lines aren't represented here:</p>
  
  <pre><code>byte[] text_bytes = File.ReadAllBytes("ok.txt");
  char[] y = Encoding.ASCII.GetChars(text_bytes);
  </code></pre>
  
  <p>I know I can just loop through each byte and have a condition to look for <code>0x09</code> and if I find it, then replace with <code>"\t"</code>, but I'm wondering if there is something built in. </p>