I am trying to create a lambda expression (Linq, C # 3.5) that can execute OrderBy on a value that has a String data type, but which actually contains a DateTime parsing.
For example, typical values ββcould be "5/12/2009", "1/14/2008", etc.
The OrderBy clause below works correctly for ordering (as string data), but I really want to treat the values ββas DateTimes and sort them by date. (SortColumn will be something like "dateCreated".)
List<MyObject> orderedList = unorderedList.OrderBy(p => p.Details.Find(s => s.Name == sortColumn).Value).ToList();
Is there a way to convert values ββto a predicate for this? Any help appreciated!
source share