C#

Using the LINQ "let" Clause

The “let” clause is useful in LINQ for re-using bits of a select or avoiding redundant computations. For illustration purposes, we pretend we’re developing a simple task manager. Computing an “Importance” score for each task, and stowing it using a let assignment allows it to be used in the sort criteria, the filter, and in the select clause.