Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumC#deferred vs immediate LINQSingle-choice MCQ

Given the code below, how many times is the database (or source) queried, and why?

var query = source.Where(x => Expensive(x)); int n = query.Count(); foreach (var item in query) { /* ... */ }