Accepted answer

Use OrderBy() in conjunction with ThenBy() with your custom comparers.

// I'm pretty sure it is not possible to specify
// your custom comparer within a query expression
List<MyObject> objects = (from a in alist
                          join b in blist on a.ID equals b.ID
                          where a.Number != 4
                          select new { a, b })
                         .OrderBy(o => o.b.Rank, new MyRankComparer())
                         .ThenBy(o => o.a.CustomField, new MyComparer<object>())
                         .Select(o => o.a)


Try this:

List<MyObject> objects = objects
    .OrderBy(a => a.Rank)
    .ThenBy(a => 
        a.CustomField, new MyComparer<object>()

It first sorts by Rank field and then by CustomField with your custom comparer.

Related Query

More Query from same tag