I'm investigating performance on an operation. I'm iterating a subset of items from a collection. I filter this collection using a Linq query. It basically looks like this:
var filteredItems = items.Where(x => x.PropertyToFilterOn == filterValue);
foreach (var filteredItem in filteredItems)
{
// do something to the filtered item
}
If I use Select
instead of Where
I achieve the same thing. Which is better to use and what is the difference?