title: variable scope inside try catch block
body: <p>I'm getting an error while trying to close my file in the <code>Finally</code> code block:</p>
  
  <pre><code>static void Main(string[] args)
  {
      try
      {
          StreamReader myReader = new StreamReader("c:\\j\\MyFile1.txt");
  
          string line = "";
  
          while (line != null)
          {
              line = myReader.ReadLine();
              Console.WriteLine(line);
          }
  
          //myReader.Close();
      }
      catch (FileNotFoundException e)
      {
          Console.WriteLine("sorry file not found! {0}", e.Message);
      }
      catch (DirectoryNotFoundException e)
      {
          Console.WriteLine("You have given the wrong path for the file! {0}", e.Message);
      }
      catch (Exception e)
      {
          Console.WriteLine("Sorry you typed in a wrong file name! {0}", e.Message);
      }
      finally
      { 
          myReader.Close();
      }
  
      Console.ReadLine();
  }
  </code></pre>