How to sort a <dynamic> list containing ExpandoObjects
I have a list containing an ExpandoObjects dictionary. I snap this to the grid, but now I want to sort the list.
var rows = new List<dynamic>(); for (int i = 0; i < 1000; i++) { dynamic expandy = new ExpandoObject(); var dictionary = (IDictionary<string, object>)expandy; dictionary.Add("ID", i); dictionary.Add("Name", "Name" + i); rows.Add(dictionary); } So, let's look at the above test code, how can I sort the lines (increase or decrease), for example, βIDβ or βNameβ or any other property that I dynamically add?
A little more information, I'm looking to sort it like this (this does not work);
var newOrder = from r in rows orderby ("Name") ascending select r; +4