title: Converting a binary file to a string and vice versa
body: <p>I created a webservice which returns a (binary) file. Unfortunately, I cannot use byte[] so I have to convert the byte array to a string.
  What I do at the moment is the following (but it does not work):</p>
  
  <p>Convert file to string:  </p>
  
  <pre><code>byte[] arr = File.ReadAllBytes(fileName);
  System.Text.UnicodeEncoding enc = new System.Text.UnicodeEncoding();  
  string fileAsString = enc.GetString(arr);  
  </code></pre>
  
  <p>To check if this works properly, I convert it back via:</p>
  
  <pre><code>System.Text.UnicodeEncoding enc = new System.Text.UnicodeEncoding();
  byte[] file = enc.GetBytes(fileAsString);
  </code></pre>
  
  <p>But at the end, the original byte array and the byte array created from the string aren't equal. Do I have to use another method to read the file to a byte array?</p>