title: Why c# don't let to pass a using variable to a function as ref or out
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/794128/passing-an-idisposable-object-by-reference-causes-an-error">Passing an IDisposable object by reference causes an error?</a>  </p>
  </blockquote>
  
  
  
  <p>Why doesn't C# allow passing a variable from a using block to a function as ref or out?</p>
  
  <p>This is my code:</p>
  
  <pre><code>using (Form s = new Form())
  {
      doSomthing(ref s);
  }
  </code></pre>
  
  <p>The function ends before the using block ends, why doesn't C# let me pass <code>s</code> as ref or out parameter?</p>