In fact, this is the same question as this post:
How can I make sure my LINQ queries execute when called in my DAL, not in a delayed fashion?
But since he didn\'
Can you explain more why .ToList is not acceptable? You mentioned boxing and unboxing but those are completely unrelated topics.
Part of forcing a LINQ query to complete on demand necessitates storing the results. Otherwise in order to see the results again, you'd have to repprocess the query. .ToList efficiently achieves this by storing the elements in a List
.
It's possible to store the elements in virtually any other collection style data structure with various trade offs that may suit your needs better.