title: How to make generic linq expression even more "generic"
body: <p>I have the following class with an expression property:</p>
  
  <pre><code>public class ClassWithExpression
  {
      public Expression&lt;Func&lt;SomeAbstractBaseClass, object&gt;&gt; SomeExpression { get; set; }
  }
  </code></pre>
  
  <p>I need an expression to be able to handle all sub-classes of <code>SomeAbstractBaseClass</code> and all types of property selectors (int, string, decimal, etc). Eventually, the expression will be passed to a linq extension method like <code>OrderBy</code>. As it stands, it locks me into properties that appear on the base class only. The <code>object</code> prop selector is problematic when trying to pass in anything but a string prop. </p>
  
  <p>I'd be okay with something like...</p>
  
  <pre><code>public class ClassWithExpression
  {
      public Expression SomeExpression { get; set; }
  }
  </code></pre>
  
  <p>... but nothing enforces that the expression is based on a sub-class of <code>SomeAbstractBaseClass</code>. Also, I'm not sure how I would pass an expression like that into the OrderBy extension method.</p>
  
  <p>Any help would be appreciated, even if it's a complete change of direction. :) </p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Sorry I didn't mention it earlier, but I can't use generics to solve this problem. Unfortunately, I don't know the types at compile-time. </p>