title: How to check if a C# Stream is resizable?
body: <p>From <a href="http://msdn.microsoft.com/en-us/library/system.io.memorystream%28v=VS.90%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.io.memorystream%28v=VS.90%29.aspx</a>:</p>
  
  <blockquote>
    <p>Memory streams created with an unsigned byte array provide a
    non-resizable stream of the data. When using a byte array, you can
    neither append to nor shrink the stream, although you might be able to
    modify the existing contents depending on the parameters passed into
    the constructor. Empty memory streams are resizable, and can be
    written to and read from.</p>
  </blockquote>
  
  <p>When provided a reference to a <code>MemoryStream</code> (or even just a <code>Stream</code>), how can one check if it's resizable?</p>
  
  <p>The situation arose when using the OpenXML SDK, which requires the streams passed to it be resizable. I can ensure resizability by deep copying to a resizable stream, I'm just wondering if there's a particular reason why the library doesn't throw an exception when a bad parameter is passed to it (i.e. an unresizable stream).</p>