title: Insertion Sorting c#
body: <p>Can you guys please help me with basic insertion sorting in C#. I have a list of names and city of residence in a array and need to sort this array by comparing the city of residence. List has to be sorted in alphabetical order. Comparator has been set up and works I'm just kinda lost with the insertion sorter programming as this is the first time we are doing that method of sorting.</p>
  
  <p>Here's what I've tried so far:</p>
  
  <pre class="lang-csharp prettyprint-override"><code>public void InsertionSort()
  {
      for (int i = 0; i &lt; Count; i++)
      {
          Student cur = Attendees[i];
          for (int j = 0; j &lt; Count; j++)
          {
              Student Sel = Attendees[j];
              if (cur.CompareTo(Sel) &lt; 0)
              {
                  Student temp = Attendees[j];
                  Attendees[j] = Attendees[i];
                  for (int k = i; k &gt; j; k--)
                      Attendees[k] = Attendees[k - 1];
                  Attendees[k + 1] = temp;
              }
          }
      }
  }
  </code></pre>