title: Determine if first char of string is upper or lower
body: <p>I'm trying to determine whether the first char of the "sentence" string is capital or not. The program runs fine, but test run gives an array index out of range error. I can't understand the problem.</p>
  
  <pre><code>public class CapitalOrNot
  {
      public static void Main()
      {
          string sentence = "Asdafasda";
          string UpOrLow = UpperOrLower(sentence);
          Console.WriteLine("First char is " + UpOrLow);
      }
  
      public static string UpperOrLower(string mj)
      {
          if (char.IsUpper(mj[0]))
          {
              mj = "upper";
          }
          else mj = "lower";
  
          return mj;
      }
  }
  </code></pre>