title: c# convert system.IO.Stream to Byte[]
body: <p>I would like to know how to convert a stream to a byte.</p>
  
  <p>I find this code, but in my case it does not work:</p>
  
  <pre><code>var memoryStream = new MemoryStream();
  paramFile.CopyTo(memoryStream);
  byte[] myBynary = memoryStream.ToArray();
  myBinary = memoryStream.ToArray();
  </code></pre>
  
  <p>But in my case, in the line paramFile.CopyTo(memoryStream) it happens nothing, no exception, the application still works, but the code not continue with the next line.</p>
  
  <p>Thanks.</p>