title: Memorystream.Read() always returns 0 bytesRead with empty byte[]
body: <p>I currently have a <a href="http://msdn.microsoft.com/en-us/library/System.IO.MemoryStream(v=vs.110).aspx" rel="noreferrer">memorystream</a> with length of about <code>30000</code> (<code>Named memStream here</code>)
  I wished to <a href="http://msdn.microsoft.com/en-us/library/system.io.memorystream.read(v=vs.110).aspx?cs-save-lang=1&amp;cs-lang=csharp#code-snippet-1" rel="noreferrer">read</a> this memorystream in <code>chunks</code> using the following code (I picked up on the net and modified somewhat):</p>
  
  <pre><code>        byte[] chunk = new byte[4096];
          bool hasNext = true;
  
          while(hasNext)
          {
              int index = 0;
  
              while (index &lt; chunk.Length)
              {
                  int bytesRead = memStream.Read(chunk, index, chunk.Length - index);
                  if (bytesRead == 0)
                  {
                      break;
                  }
                  index += bytesRead;
                  //Do something with this chunk
              }
              if (index != 0) // Our previous chunk may have been the last one
              {
                  //Do something with the last chunk
              }
              if (index != chunk.Length) // We didn't read a full chunk: we're done
              {
                  hasNext = false;
              }
          }
  </code></pre>
  
  <p>yet the following <code>read()</code>method doesn't appear to be working</p>
  
  <pre><code>  int bytesRead = memStream.Read(chunk, index, chunk.Length - index);
  
    WHERE
      chunk: new byte[4096]
      index: 0
      memstream: capacitiy &amp; length : 34272
      memstream: position 0 (according to VS watch)
  
   Always returns
      0 bytesRead
      Chunk with all values containing '0'
  </code></pre>
  
  <p>Any idea why? Could this be a rights permission?</p>
  
  <p>Thank you for your time.</p>