title: Preventing to dispose objects multiple times
body: <p>Consider the following code:</p>
  
  <pre><code>using (Stream stream = new FileStream("file.txt", FileMode.OpenOrCreate))
  {
      using (StreamWriter writer = new StreamWriter(stream))
      {
          // Use the writer object...
      }
  }
  </code></pre>
  
  <p>When the <code>writer</code> stream is beeing disposed it disposes internally the FileStream <code>stream</code>. </p>
  
  <p>Is there any other desgin for this other than the <a href="http://msdn.microsoft.com/en-us/library/vstudio/ms182334%28v=vs.110%29.aspx" rel="noreferrer">MSDN recommendation</a> to dispose the external used stream in the finally clause:</p>
  
  <pre><code>Stream stream = null;
  try
  {
      stream = new FileStream("file.txt", FileMode.OpenOrCreate);
      using (StreamWriter writer = new StreamWriter(stream))
      {
          stream = null;
          // Use the writer object...
      }
  }
  finally
  {
      if(stream != null)
          stream.Dispose();
  }
  </code></pre>