score:0

myrepository.all.where(r=>mycollection.select(a=>a.id).contains(r.id))

score:0

linq has an .intersect that should get you want you need.

something like this:

var result = myrepository.intersect(mycollection).tolist();

more info: http://msdn.microsoft.com/en-us/library/system.linq.enumerable.intersect.aspx

score:1

var result = (from r in myrepository.all
              join r2 in mycollection on r.id equals r2.id
              select r).tolist();

score:4

cache the ids of mycollection into a hashset.
than you can retrieve your result with a where clause like this :

var myidsets = new hashset(mycollection.select(c => c.id));

var result = myrepository.all.where(r=> myidsets.contains(r.id)).tolist();

score:9

from a in myrepository.all
join m in mycollection on a.id equals m.id
select a

Related Query

More Query from same tag