title: Sorting C# List based on Dictionary elements
body: <p>in my C# program I have a list, which I populate with Dictionary elements:</p>
  
  <pre><code>List&lt;Dictionary&lt;string, object&gt;&gt; mylist = new List&lt;Dictionary&lt;string, object&gt;&gt;();
  Dictionary&lt;string, object&gt; d1 = new Dictionary&lt;string, object&gt;();
  d1.Add("val1", 1);
  d1.Add("val2", 2);
  d1.Add("val3", 3);
  mylist.Add(d1);
  Dictionary&lt;string, object&gt; d2 = new Dictionary&lt;string, object&gt;();
  d2.Add("val1", 4);
  d2.Add("val2", 5);
  d2.Add("val3", 6);
  mylist.Add(d2);
  Dictionary&lt;string, object&gt; d3 = new Dictionary&lt;string, object&gt;();
  d3.Add("val1", 7);
  d3.Add("val2", 8);
  d3.Add("val3", 9);
  mylist.Add(d3);
  </code></pre>
  
  <p>I would like to sort the list according to a certain element in the dictionary elements, e.g., sort the list according to the "val3" object in the dictionaries. I tried this:
      mylist.OrderBy(x => x["val3"]);
  My list order was still the same. Any idea what I did wrong? Thanks</p>