Is Linq Faster, Slower or the same?
Posted
by Vaccano
on Stack Overflow
See other posts from Stack Overflow
or by Vaccano
Published on 2010-05-21T17:26:13Z
Indexed on
2010/05/21
17:30 UTC
Read the original article
Hit count: 178
Is this:
Box boxToFind = AllBoxes.Where(box => box.BoxNumber == boxToMatchTo.BagNumber);
Faster or slower than this:
Box boxToFind ;
foreach (Box box in AllBoxes)
{
if (box.BoxNumber == boxToMatchTo.BoxNumber)
{
boxToFind = box;
}
}
Both give me the result I am looking for (boxToFind). This is going to run on a mobile device that I need to be performance conscientious of.
© Stack Overflow or respective owner