Possible Duplicate:
Multiple “order by” in LINQ
I want to order some dataset by some field AND THEN some other field.
Using lambda expressions this would be easy (OrderBy.ThenBy), but how to do it when I have a syntax like this:
 int maxQueries = int.MaxValue;
        // finds the most search for queries
        var ordered = from p in searchLogs
        where !string.IsNullOrEmpty(p.SearchQuery)
        group p by new 
        { 
           SearchQuery = p.SearchQuery
        } 
        into pgroup
        let count = pgroup.Count()
        orderby count descending
        select new 
        { 
            Count = count, 
            SearchQuery = pgroup.Key.SearchQuery
        };
I can't seem to find a way which works after the decending keyword (like orderby count descending then searchquery)..
Any ideas?
Put a comma after descending and specify the next thing to sort by (optionally adding descending) and so on
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With