title: Will all objects created inline in a `using` statement be disposed of?
body: <p>This may be answered elsewhere, but after doing a bit of searching I didn't find much on the subject outside of the normal <code>using</code> context.  </p>
  
  <p>I am curious if <em>all</em> objects created in a <code>using</code> block will be disposed of as well as the original object.</p>
  
  <p><strong>Here is the context:</strong></p>
  
  <p><em>Normally</em> I would do something like this:</p>
  
  <pre><code>using (var conn = new SqlConnection(connectionString))
  using (var cmd = new SqlCommand(commandText, conn))
  {
      //Do everything I need to here
  }
  </code></pre>
  
  <p>I know that both <code>conn</code> and <code>cmd</code> go out of scope at this point and are disposed of because of the lovely <code>using</code> keyword.  </p>
  
  <p>I am curious if the same disposal rules would apply to the following statement:</p>
  
  <pre><code>using (var cmd = new (SqlCommand(commandText, new SqlConnection(ConnectionString)))
  {
     //Do everything I need here
  }
  </code></pre>
  
  <p>Would the <code>SqlConnection</code> object that was created inline in the <code>using</code> statment be disposed of when <code>cmd</code> goes out of scope and is disposed of because it's associated with the object?</p>
  
  <p>Also which would be syntactically preferred?  I personally think the 2nd is cleaner, but I understand readability may come to play here as well.  </p>