title: Sort ArrayList with two dimensional objects
body: <p>I have an ArrayList where I store 10 objects with two random generated numbers each and I want to sort the list by the Y values of the objects.</p>
  
  <pre><code>Random rndm = new Random();
  ArrayList CustomList = new ArrayList();
  
  for (int i = 0; i &lt; 10; i++) 
  {
      Point LP = new Point(rndm.Next(50), rndm.Next(50));
      CustomList.Add(LP); 
  }
  
  PrintList(CustomList);
  CustomList.Sort(); 
  PrintList(CustomList);
  </code></pre>
  
  <p>The <code>Sort</code> method throws the following exception:</p>
  
  <pre><code>System.InvalidOperationException: The comparer threw an exception. ---&gt; System.ArgumentException: At least one object must implement IComparable.
  </code></pre>
  
  <p>I assume it doesn't work because the Sort method can not handle two dimensional objects in the ArrayLists. How can I get the Sort method to work now?</p>