title: C# disposing objects
body: <p>I know the Dispose() method is called on the StreamReader object when you have the following code:</p>
  
  <pre><code>//Sample 1
  using (StreamReader sr1 = new StreamReader(@"C:\Data.txt"))
  {
      string s1 = sr1.ReadToEnd();
      //Do something with s1...
  }
  </code></pre>
  
  <p>But if you write the code like this (Sample 2) will the Dispose() method get called too?</p>
  
  <pre><code>//Sample 2
  StreamReader sr2 = new StreamReader(@"C:\Data.txt");
  using (sr2)
  {
      string s2 = sr2.ReadToEnd();
      //Do something with s2...
  }
  </code></pre>