title: why can't I assign object variables within the try block?
body: <p>Why can't I assign object variables within the <code>try</code> block?</p>
  
  <p>If I attempt to do this and clean up the variable in the <code>finally</code> block I get a compiler error: <em>"use of unassigned local variable"</em>.   This makes no sense because the variable is declared before the <code>try</code> block, and in the <code>finally</code> block I am first checking whether the variable is <code>null</code>.</p>
  
  <p>Why can't the following code compile?  I am checking whether <code>dbc</code> is <code>null</code> so there's no chance of it trying to do something with an unassigned variable.</p>
  
  <p>eg:</p>
  
  <pre><code>DbConnection dbc;
  try {
      dbc = &lt;some method call returning an open DbConnection&gt;
      // do stuff
  } catch (Exception e) { // do stuff }
  finally { 
      if (dbc != null) {
          dbc.Close();
      }
  }
  </code></pre>