title: How to sort an array of objects (classes)?
body: <p>I'm trying to sort an array of objects with <code>Array.Sort</code>, but get an InvalidOperationException. As i have read i'm trying to sort a complex object and I need to use a <code>IComparable &lt;T&gt;</code> comparsion interface, but I don't understand how it works.</p>
  <p>There is my code:</p>
  <pre><code>     public class C
       {
           public int I { get; set; }
       }
  
       static void Main(string[] args)
       {
           C[] classes = new C[100000];
           Random rand = new Random();
           for (int i = 0; i &lt; 100000; i++)
           {
              classes[i] = new C { I = rand.Next(1, 100000) };
           }
       
           Array.Sort&lt;C&gt;(classes); // Here I get an exception
       }
  </code></pre>