title: Check to see what item in ArrayList is smaller c#
body: <p>I am trying to make my own multithreaded mergesort algorithm by using an ArrayList. I am familiar with this method in Java but trying to bring it over to c# is not working as planned. I get the following error when trying to compare two ArrayList items <code>Error 1   Operator '&lt;' cannot be applied to operands of type 'object' and 'object'</code>. I know you cannot directly compare two objects like that, in Java you can use compareTo or something like that, is there any equivalent for c#?</p>
  
  <p>Here is the code causing the error in case you need it, bear in mind that I copied this from one of my Java programs that worked with integer arrays.</p>
  
  <pre><code>int size = (last - first) + 1;
  ArrayList temp = new ArrayList();            
  int mid = (first + last) / 2;
  int i1 = 0;
  int i2 = first;
  int i3 = mid + 1;
  while(i2 &lt;= mid &amp;&amp; i3 &lt;= last) 
  {
      if(list[i2] &lt; list[i3])
          temp[i1++] = list[i2++];
      else temp[i1++] = list[i3++];
  }
  
  while(i2 &lt;= mid)
      temp[i1++] = list[i2++];
  
  while(i3 &lt;= last)
      temp[i1++] = list[i3++];
  
  i3 = first;
  for(i1 = 0; i1 &lt; temp.Count; i1++, i3++)
      list[i3] = temp[i1];
  </code></pre>