// lets enumerate the list items
foreach (var listItem in myEnum)
{
// for each of the elements filter the list for all items
// "less" than the current item
var myItem = (from x in myOrderedList
where x.CustomWhere(listItem)
select x).FirstOrDefault();
Console.WriteLine(myItem);
}

As you can see I’ve used two methods (extension methods that will simply count the method calls) for sorting and filtering. So let’s have a look for the method calls:
CustomOrderBy: 25 Aufrufe
CustomWhere: 19 Aufrufe
Whow! 25 calls to CustomOrderBy – with a simple sorting algorithm I would expect 5 … there’s only one statement iterating the elements – but wait: the linq statement does NOT iterate the elements; it’s generating a class that will iterate the elements when accessing it. So each time we access the result of the Linq query, the query is being executed – in our case 5 times in the for-loop = 25 executions for the where statement.
The solution is really simple:

This will enforce the execution of the linq query one time outside the loop and convert the IEnumeratable into a List. In this case we do have a type containing the elements and not the definition how to get the elements, so the “where” will not be executed again.