Tuesday

LINQ Join vs SelectMany:what is faster?



Customer[] customers = Customers.ToArray();
Purchase[] purchases = Purchases.ToArray();

var slowQuery =
from c in customers
from p in purchases where c.ID == p.CustomerID
select c.Name + " bought a " + p.Description;

var fastQuery =
from c in customers
join p in purchases on c.ID equals p.CustomerID
select c.Name + " bought a " + p.Description;

slowQuery.Dump ("Slow local query with SelectMany");
fastQuery.Dump ("Fast local query with Join");


more...

No comments:

imagemagic add text to image

rem different types of text annotations on existing images rem cyan yellow orange gold rem -gravity SouthWest rem draw text and anno...