Code equivalent to the ‘let’ keyword in chained LINQ extension method calls

Let doesn’t have its own operation; it piggy-backs off of Select. You can see this if you use “reflector” to pull apart an existing dll.

it will be something like:

var result = names
        .Select(animalName => new { nameLength = animalName.Length, animalName})
        .Where(x=>x.nameLength > 3)
        .OrderBy(x=>x.nameLength)
        .Select(x=>x.animalName);

Leave a Comment