Which LINQ method forces immediate execution of a query?
Correct answer D. ToList
Explanation
Operators that return a single value or a materialised collection, such as ToList, ToArray, Count, Sum and First, execute the query at once. Where, Select and OrderBy return deferred sequences that run only when enumerated. Calling ToList is useful when you want a snapshot of the results or need to avoid running an expensive query more than once.
Answer checked How we write and check questions
Discussion