title: Does c# using statement need assignment?
body: <p>At first I had some code like this:</p>
  
  <pre><code>WindowsIdentity otherIdentity = // got that from somewhere else
  WindowsImpersonationContext context = otherIdentity.Impersonate();
  Ldap.DoStuff();
  context.Undo();
  context.Dispose();
  </code></pre>
  
  <p>Knowing that <code>WindowsImpersonationContext</code> implements <code>IDisposable</code> and <code>Dispose()</code> also calls <code>Undo()</code>, I think I should be using <code>using</code> instead:</p>
  
  <pre><code>using (var context = otherIdentity.Impersonate())
  {
      // Run as other user
      Ldap.DoStuff();
  }
  </code></pre>
  
  <p>Now, ReSharper correctly notices that I am not using <code>context</code> and suggests to remove the assignment. Does this also work? To what code does it expand at compile time?</p>
  
  <pre><code>using (otherIdentity.Impersonate())
  {
      Ldap.DoStuff();
  }
  </code></pre>