I would like to be able to store a list of expressions to execute with IQueryable.OrderBy at a later time, something like:
List<Expression<Func<MyType, object>>> list = new List<Expression<Func<MyType, object>>>();
list.Add(x => x.Date);
list.Add(x => x.ID);
IOrderedQueryable<MyType> qry = query.OrderBy(list[0]).ThenBy(list[1]);
However doing this throws an InvalidOperationException - Cannot order by type 'System.Object' because the expression is defined with object and not a specific type like Expression<Func<MyType, DateTime>>
or Expression<Func<MyType, int>>
How can I store a list of expressions so that I can execute them later in a OrderBy method?