title: How to sort List<T>?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3163922/sort-a-custom-class-list">Sort a Custom Class List&lt;&gt;</a>  </p>
  </blockquote>
  
  
  
  <p>I have a Generic Collector <code>List</code> and some code adding <code>CmsCategory</code> in an unordered way to the Collector. <code>CmsCategory</code> has fields <code>int CategoryId</code> and <code>string Title</code>.</p>
  
  <pre><code>List&lt;CmsCategory&gt; categories = new List&lt;CmsCategory&gt;();
  categories.Sort();
  </code></pre>
  
  <p>After the insertion is completed I need to to get all objects in the collector sorted by <code>CategoryId (ascending)</code>.</p>
  
  <p>I receive this error:</p>
  
  <blockquote>
    <p>At least one object must implement IComparable. </p>
  </blockquote>
  
  <p>My questions:</p>
  
  <ul>
  <li><p>What I'm doing wrong here using <code>List&lt;T</code>>?</p></li>
  <li><p>Do you know more appropriate Generic Collector for this kind of operations?</p></li>
  </ul>
  
  <p>Thanks for your time on this.</p>