title: Why the limitations on Dictionary sorting in C#?
body: <p>Have recently taken over an application from another developer who was very Dictionary-happy, using them all over the place with varying degrees of appropriateness.</p>
  
  <p>I've gotten an awful lot of change requests to having various things in the application sorted, which is obviously a problem since you can't sort a Dictionary. I knew that: I've been bitten by it before, and it's one reason I avoid Dictionaries unless there's really no other solution. </p>
  
  <p>What I didn't expect was how limited SortedDictionary was in the sense that, out of the box, it only sorts by Key and only sorts in one direction.</p>
  
  <p>I'm not particularly interested in solutions to this: SO is already full of them. I'm just curious as to whether there are good technical or architectural reasons as to <em>why</em> there's still no functionality in C# to sort a Dictionary, and why the default behaviours on SortedDictionary are so limited?</p>
  
  <p>EDIT: A specific example was called for, so here's one I'm working on. Bear in mind I'm not looking for a solution here (I created an <code>IComparer</code> to do the job in real life) - this is just for illustration.</p>
  
  <p>In this instance, it's a WPF application and the Dictionary is used as a way of storing Key/Value pairs together so that the user interface can create a combobox with <code>DisplayMemberPath="Key" SelectedValuePath="Value</code>".</p>
  
  <pre><code>Dictionary&lt;string, int&gt; JobsDict = rep.Jobs_Get()
                                       .Where(x =&gt; x.MemberID == SelectedMemberID)
                                       .ToDictionary(x =&gt; x.Description, x =&gt; x.JobID);
  
  //Jobs is a property of type SortedDictionary&lt;string, int&gt; that the UI binds to
  Jobs = new SortedDictionary&lt;string, int&gt;(JobsDict);
  
  //what I'd like to do at this point is ...
  Jobs.OrderByDescending(x =&gt; x.Value);
  //so that the user sees the most recent values at the top of the list
  </code></pre>