title: Should I call Close() or Dispose() for stream objects?
body: <p>Classes such as <code>Stream</code>, <code>StreamReader</code>, <code>StreamWriter</code> etc implements <code>IDisposable</code> interface. That means, we can call <code>Dispose()</code> method on objects of these classes. They've also defined a <code>public</code> method called <code>Close()</code>. Now that confuses me, as to what should I call once I'm done with objects? What if I call both? </p>
  
  <p>My current code is this:</p>
  
  <pre><code>using (Stream responseStream = response.GetResponseStream())
  {
     using (StreamReader reader = new StreamReader(responseStream))
     {
        using (StreamWriter writer = new StreamWriter(filename))
        {
           int chunkSize = 1024;
           while (!reader.EndOfStream)
           {
              char[] buffer = new char[chunkSize];
              int count = reader.Read(buffer, 0, chunkSize);
              if (count != 0)
              {
                 writer.Write(buffer, 0, count);
              }
           }
           writer.Close();
        }
        reader.Close();
     }
  }
  </code></pre>
  
  <p>As you see, I've written <code>using()</code> constructs, which automatically call <code>Dispose()</code> method on each object. But I also call <code>Close()</code> methods. Is it right?</p>
  
  <p>Please suggest me the best practices when using stream objects. :-)</p>
  
  <p>MSDN example doesn't use <code>using()</code> constructs, and call <code>Close()</code> method:</p>
  
  <ul>
  <li><a href="http://msdn.microsoft.com/en-us/library/ms229711.aspx" rel="noreferrer">How to: Download Files with FTP</a></li>
  </ul>
  
  <p>Is it good?</p>