title: Memory stream is not expandable even when incapsulated in using()
body: <p>I am using multiple memory streams to convert my file names to stream and write in them like so:</p>
  
  <pre><code>public static void Save() {
      try {
          using (MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes("Clients.txt"))) {
              using(StreamWriter sw = new StreamWriter(ms)) {
                  writeClients(sw);
              } */ Line 91 */
          }
  
          using (MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes("Hotels.txt"))) {
              using(StreamWriter sw = new StreamWriter(ms)) {
                  writeHotels(sw);
              }
          } 
          [...]
      } catch {
          [...]
      }
  }
  </code></pre>
  
  <p>but somehow when I call <code>Save()</code> I get the following error:</p>
  
  <pre><code>Unhandled Exception: System.NotSupportedException: Memory stream is not expandable.
     at System.IO.__Error.MemoryStreamNotExpandable()
     at System.IO.MemoryStream.set_Capacity(Int32 value)
     at System.IO.MemoryStream.EnsureCapacity(Int32 value)
     at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)
     at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
     at System.IO.StreamWriter.Dispose(Boolean disposing)
     at System.IO.TextWriter.Dispose()
     at csharp.Program.Save() in /home/nids/Documents/csharp/Program.cs:line 91
     at csharp.Program.Main(String[] args) in /home/nids/Documents/csharp/Program.cs:line 290
  </code></pre>
  
  <p>Where line 290 is the line where I call <code>Save()</code></p>
  
  <p>I'm not sure what's causing the error!</p>