in .net, it is possible to write:
(from n in numbers where n == 5 select n).ToList();
without those brackets, it is not possible to call the ToList() method. how can i explain to someone what this line does (all i can say is it precompiles the query, but i do not know if this is actually 100% correct).
That looks to me like a LINQ expression wrapped in parentheses, the result of which will be
IEnumerable<int>followed by a call to theIEnumerable<T>extension methodToList<T>().I think in this case, the call
ToList<T>forces the expression to be evaluated immediately, essentially foregoing any laziness to the evaluation.Eric White wrote a good article on Lazy (and Eager) Evaluation with LINQ