title: C# try and catch
body: <p>I've just signed up to the website so I have probably put this wrong. Anyways, I am trying to use the try and catch in C# to catch my file if it not found. Here is my code for it at the moment. To repeat myself, I want the program to read the file in, as it does- but then if the file is not found, I would like it to give an error saying "cannot find the file" or something along those lines, not simply just crash. (I've just started learning C#)</p>
  
  <p>Thanks for the help!</p>
  
  <pre><code>string file = @"C:\Users\Henry\Desktop\Assessments\Programming and data structures\grades_multiple.txt";
  try
  {
      file = @"C:\Users\Henry\Desktop\Assessments\Programming and data structures\grades_multiple.txt";
  }
  catch
  {
      Console.WriteLine("Could not find the file - grades_multiple.txt");
  }            
  //ARRAY for string lines
  string[] Line = new string[6];
  Line[0] = File.ReadLines(file).Skip(1).Take(1).First();
  </code></pre>