title: compare substring in C# LINQ
body: <p>I am new to programming and learning C#. This chapter introduced me to database and the SQL structure, and then swiftly lept into LINQ. So my understanding at this point is extremely fundamental. My assignment:</p>
  
  <p>Create a program named SplitAlphabet that contains an array of 20 words of your choice. Use LINQ statements to display separate lists: One shows words that begin with letters in the first half of the alphabet (A through M), and the other list shows words that begin with letters in the second half (N through Z).</p>
  
  <p>I tried to make it work in LINQ then decided to back up a bit and just do it in C# to make sure I had the syntax correct.</p>
  
  <pre><code>private void btnDisplay_Click(object sender, EventArgs e)
  {
      lstResults1.Items.Clear();
      lstResults2.Items.Clear();
      string[] strings = {"book", "zebra"};
      string subtrResult = strings[0].Substring(0,1);
      var substCompare = strings[0].Compare((strings[0].Substring(0, 1)), "n");
      lstResults1.Items.Add(subtrResult);
      lstResults2.Items.Add(substCompare);
      /*
       var AM =
          from x in strings
          where (x.CompareTo((x.Substring(0, 1)), "n")) == -1
          select x;
      */
  }
  </code></pre>
  
  <p><code>substrResult</code> successfully displayed <code>"b"</code> in the <code>lstResults1</code> listbox. The error showing for the <code>substcompare</code> variable is:</p>
  
  <blockquote>
    <p>Member 'string.Compare(string, string)' cannot be accessed with an
    instance reference; qualify it with a type name instead.</p>
  </blockquote>
  
  <p>I replaced var with int and decimal and the message remained the same.</p>
  
  <p>I also don't know if this translates to LINQ as easily as I hope.</p>