title: Does c# uses IDisposable / Dispose for temporary COM objects?
body: <p>To make sure that a COM object that I need to create is freed/released as soon I didn't need it anymore is simple with the <code>using</code> statement.</p>
  
  <pre><code>using (dynamic a = new MyFooCOMApplication()) 
  { 
  ...
  }
  </code></pre>
  
  <p>Now suppose I have a Foo COM object. This Foo object has a COM enumeration called Fields, and Fields itself return item of type Field. Assume that the Field object has a property Value, I can write code like:</p>
  
  <pre><code>a.Fields("Test").Value
  </code></pre>
  
  <p>Or in other words:</p>
  
  <pre><code>a.Fields.Item("Test").Value = 0;
  </code></pre>
  
  <p>With this statement two temporary objects are created. One of type Fields, one of type Field.</p>
  
  <p>Now my question: Does C# implicit uses a using clause for the both temporary objects or must I write:</p>
  
  <pre><code>using (dynamic fields=a.Fields) 
  {
     using (dynamic field=fields.Item("Test")) 
     {
       field.Value = 0;
     }
  }
  </code></pre>
  
  <p>Just to clarify:</p>
  
  <ol>
  <li>I use an external COM server. So freeing the objects is absolutely required. </li>
  <li>Calling the GC.Collect isn't "what I feel" a good style. Even if hundreds of programmers are using it.</li>
  <li>The code itself is again inside an VSTO Addin of Outlook. So I want to work as clean as possible.</li>
  </ol>