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.
DRY (Don’t Repeat Yourself) is a useful mantra when developing maintainable, readable code. ASP.NET MVC (with Razor view-engine) gives you multiple ways to remove unnecessary redundancy in your views. Approach 1: @helper Methods Although the @helper method syntax has been around a while and some of the other approaches below are more prevalent, @helper methods are still supported and may be a good solution for small bits of reusable view code.