title: C# stop user inputting a character/string instead of integer
body: <p>I am asking users to input a int for their age but the program crashes when they input a string(obviously).</p>
  
  <p>How would I go about allowing them to input a char/string but the program to display a funny message and then quit?.</p>
  
  <p>This is what I have got so far:</p>
  
  <pre><code>      Console.WriteLine("Please can you enter your age");
          int userage = Convert.ToInt32(Console.ReadLine());
          if (userage &lt; 16)
          {
  
              var underage = new underage();
              underage.text();
          }
          else if (userage&gt;122)
          {
              Console.WriteLine("No one has ever reached this age and so you can't possibly be this old");
              Console.WriteLine("Please enter a different age next time!");
              Console.WriteLine("Unless you really are this old, in which case don't work!!");
              Console.WriteLine("Press any key to exit the program.\n");
              Environment.Exit(0);
          }
          else if(userage&lt;122)
          {
              Console.WriteLine("Ah brilliant, you are old enough to use our services\n");
              Console.WriteLine("We shall continue as first planned\n");
          }
          else
          {
  
          }
  </code></pre>