title: Does Dispose still get called when exception is thrown inside of a using statement?
body: <p>In the example below, is the connection going to close and disposed when an exception is thrown if it is within a <code>using</code> statement?</p>
  
  <pre><code>using (var conn = new SqlConnection("..."))
  {
      conn.Open();
      // stuff happens here and exception is thrown...
  }
  </code></pre>
  
  <p>I know this code below will make sure that it does, but I'm curious how using statement does it.</p>
  
  <pre><code>var conn;
  try
  {
      conn = new SqlConnection("...");
      conn.Open();
      // stuff happens here and exception is thrown...
  }
  // catch it or let it bubble up
  finally
  {
      conn.Dispose();
  }
  </code></pre>
  
  <p><h3>Related:</h3> <a href="https://stackoverflow.com/questions/141204/what-is-the-proper-way-to-ensure-a-sql-connection-is-closed-when-an-exception-is">What is the proper way to ensure a SQL connection is closed when an exception is thrown?</a></p>