title: Sorting a list of ExpanoObejct by the properties using reflection
body: <p>I want to sort a <code>List(Of MyDynamicObject)</code> by it's properties, where <code>MyDynamicObject</code> is an <code>ExpandoObject</code>. I have the property names as strings, so I need to use  some sort of reflection to pass them.</p>
  
  <p>Let's say I have a list:</p>
  
  <pre><code>MyList = New List(Of Entry)
  </code></pre>
  
  <p>where <code>Entry</code> has a property <code>MyProperty_01</code>.<br> Now I want to sort <code>MyList</code> by the objects property <code>MyProperty_01</code>.</p>
  
  <p>In case of static objects and no reflection, I would do something like this this:</p>
  
  <pre><code>MyList = MyList.OrderBy(Function(x) x.MyProperty_01).ToList
  </code></pre>
  
  <p>Now if I need to pass the property name as a string, I can do this:</p>
  
  <pre><code>Dim MyPropertyName As String = "MyProperty_01"
  MyList = MyList.OrderBy(Function(x) GetType(Entry).GetProperty(MyPropertyName).GetValue(x)).ToList
  </code></pre>
  
  <p>where <code>Entry</code> is the objects class reference.</p>
  
  <p>How can I do this with an <code>ExpandoObject</code>? I don't have a class reference in case of an <code>ExpandoObject</code>.</p>
  
  <p>So this doesn't work anymore.</p>
  
  <pre><code>Dim MyPropertyName As String = "MyProperty01"
  MyList = MyList.OrderBy(Function(x) GetType().GetProperty(MyPropertyName).GetValue(x)).ToList
  </code></pre>