Please help me with building tree expression from this lambda expression
x => (DateTime)x[key].Date
x of SPListItem type. class Expression contains different methods - Expression.Property(...), Expression.MemberInit(...) - I can't understand how to use this. What methods use in different cases.
I spent three days to solve this task and no luck.
Upd. Some details: I'm working with SharePoint and I need to sort SPListItemCollection by some fields. In case of DateTime field, it must be sorted only by date. I can't do this with CAML query, so I can use linq.
OrderBy(item => (DateTime)item[fieldName].Date)
works perfectly. But there are can by many parameters for sorting. I try to create dynamic linq query with help of Expression class. And if my lambda expression was, for example, x=>x.property,it will be simple
var pe = Expression.Parameter(typeof(x));
var property1 = typeof(x).GetProperty(property);
But how I can do this for (item => (DateTime)item[fieldName].Date)?