title: MemoryStream - Cannot access a closed Stream
body: <p>Hi why  <code>using (var sw = new StreamWriter(ms))</code> returns <code>Cannot access a closed Stream</code> <code>exception</code>. <code>Memory Stream</code> is on top of this code. </p>
  
  <pre><code>using (var ms = new MemoryStream())
  {
      using (var sw = new StreamWriter(ms))
      {                 
          sw.WriteLine("data");
          sw.WriteLine("data 2");
          ms.Position = 0;
          using (var sr = new StreamReader(ms))
          {
              Console.WriteLine(sr.ReadToEnd());                        
          }
      } //error here
  }
  </code></pre>
  
  <p>What the best way to fix it ?
  Thanks </p>