title: how to catch exception for invalid data entry?
body: <p>I want to catch the exceptions when the end user types invalid format or left the field without entering any data.I used string type for first Name and Last Name.Here is the problem since the string type accepts both string type data and numeric data catch block is not able to catch the exceptions for invalid data entry.Also since string type default value is null, not able to catch the exception when field is left empty.</p>
  
  <p>For example, I want to catch the exception when user types 123 in the fname field or left the field without entering data.</p>
  
  <pre><code>     static void Main(string[] args)
      {
          string fName = null;
          string lName = null;
  
          try
          {             
  
              Console.Write("Enter your first Name  ");
              fName = Console.ReadLine();
  
              Console.Write("Enter your Last Name  ");
              lName = Console.ReadLine();
          }
          catch (Exception e)
          {
              Console.WriteLine(e.Message);
              Console.WriteLine("Please enter correct format");
          }
  
       }
  </code></pre>