score:2

Accepted answer

if there is no common sub-class among these element types, you can use linq to project the lists using a generic tuple<int, int, object> (i.e. rating, vote, and the original element instance) containing the two properties you are interested in. then you can do a simple query to pick the top 10 elements:

list<a> ax = /* ... */;
list<b> bx = /* ... */;
list<c> cx = /* ... */;
/* ... */

ienumerable<tuple<int, int, object>> ratingsandvotes =
    ax.select((a) => tuple.create(a.rating, a.vote, a)).concat(
    bx.select((b) => tuple.create(b.rating, b.vote, b)).concat(
    cx.select((c) => tuple.create(c.rating, c.vote, c)) /* ... */;
tuple<int, int, object>[] toptenitems = 
    ratingsandvotes.orderbydescending((i) => i.item1).thenbydescending((i) => i.item2).take(10).toarray();
// toptenitems now contains the top 10 items out of all the lists;
// for each tuple element, item1 = rating, item2 = vote,
// item3 = original list item (as object)

score:1

you can use orderby and thenby to order by two (or more) fields and then use take to get the top 10:

var mylist = new list<film>();
// ... populate list with some stuff
var top10 = mylist.orderby(f => f.rating).thenby(f => f.vote).take(10);

hope that helps :)

score:3

you can start with something like:

  var res = l1.concat(l2).concat(l3).concat(l4).concat(l5)
                    .orderbydescending(k => k.rating)
                    .thenby(k=>k.vote)
                    .take(10).tolist();

where l1...l5 are your lists

score:8

try something like below

var topten = yourlist.orderby(x => x.rating).thenby(z => z.vote).take(10)


Related Query

More Query from same tag