into and let create temporary reference to store the result of a subquery/subexpression that can be later queried itself. These operators keep deferred execution and allow creation of sub routines that can be used incrementally or progressively. Personally, I would rather try simplifying the query, so I will not use either of these keywords. A few separate queries are much debugger [developer] friendly and less bug prone.
As a sample, let can be used to store the count of elements in a group
var categories = from p in products
group p by p.Category into g
let elCount = g.Count()
select new
{ Category = g.Key,
ElementCount = elCount
};
Hello admin, Excellent article. You have gained a fresh reader. Please keep them coming and I look forward to more of your superb articles. Thanks a lot....
ReplyDeletePIC Scheme Singapore