title: Limiting c# user interface to one input
body: <p>I have written an application to determines whether the character enter is Uppercase, Lowercase or numerical. However, I was wondering how I could make the application limit the amount of characters a user can input to just one?</p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          try
          {
              Console.Write("Enter a character: ");
              char c = (char)Console.Read();
              if (Char.IsLetter(c))
              {
                  if (Char.IsLower(c))
                  {
                      Console.WriteLine("The character is lowercase");
                      Console.Write("Press any key to exit...");
                      Console.ReadKey();
                  }
                  else
                  {
                      Console.WriteLine("The character is uppercase");
                      Console.Write("Press any key to exit...");
                      Console.ReadKey();
                  }
  
              }
  
              else
              {
                  Console.WriteLine("Not an alphabetic character");
                  Console.Write("Press any key to exit...");
                  Console.ReadKey();
              }
          } // Try 
  
          catch {
  
          }
  
      }
  }
  </code></pre>