title: Compare types of keys for SortedDictionary
body: <p>I want to write a custom comparer for a <code>SortedDictionary</code>, where keys are sorted based on their type. Is this possible?</p>
  
  <pre><code>public class StateBase
  {
      // This is a base class I have to inherit from
  }
  
  SortedDictionary&lt;StateBase, int&gt; _stateDictionary =
      new SortedDictionary&lt;StateBase, int&gt;(new StateComparer());
  
  class StateComparer : IComparer&lt;StateBase&gt;
  {
      public int Compare(StateBase a, StateBase b)
      {
          // I'd like to sort these based on their type
          // I don't particularly care what order they are in, I just want them
          // to be sorted.
      }
  }
  </code></pre>