title: Do we have to declare variable within try block or outside the try block?
body: <p>What is the best practice/recommendation to declare and use the variable with try/catch/finally ?.</p>
  
  <p>do we have to declare the variable out side of the try block and dispose on the finally ? or declare within try block and get dispose automatically ?</p>
  
  <pre><code>string Name = String.Empty;
  try
  {
      //do work
  }
  catch
  {
     //safely access s
     Console.WriteLine(Name);
  }
  
  OR
  
  string Name;
  try
  {
      //do work
  }
  catch
  {
     if (!String.IsNullOrEmpty(Name))
     {
         //safely access s
         Console.WriteLine(Name);
     }
  }
  </code></pre>