Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Benefits of manual lookup over joining in LINQ?

Is constructing and using a manual lookup (ILookup<T>) approach any faster than using a join with Join or GroupJoin on a local IEnumerable<T> sequence in LINQ?

I read somewhere that the compiler actually translates the inner sequence of Join and GroupJoin to ILookup<T> anyway.

What would ILookup<T> benefits of using it on it's own be?

like image 254
TheBoyan Avatar asked Mar 09 '11 13:03

TheBoyan


1 Answers

It depends. If you're working with objects that are DataContext based, then the join gets translated all the way down into the SQL server via the select statement. IF its a POCO (or more specifically a Plain Old CLR collection) or something else, then yes, its utilized as ILookup.

like image 156
enorl76 Avatar answered Oct 13 '22 21:10

enorl76