3 ms·
> the _only_ place where it offers a readability improvement over ext-methods is using `join` No love for let? from item in items let frob = Expensei
by recursive 3y ago
> the _only_ place where it offers a readability improvement over ext-methods is using `join`
No love for let?
from item in items
let frob = Expenseive(item.P1)
where frob > 3
selec new { frob, item }
- DaiPlusPlus 3y agoThat can be done with ValueTuples instead of Anonymous Types: `items.Select( i => ( i, frob: Expensive( i.P1 ) ) ).Where( t => t.frob > 3 );` ...and ValueTuples are superior to Anonymous Types because you can actually return them from a function or use them as parameters - whereas Anonymous Types cannot cross method-call boundaries (excepting using generics for pass-through). Anonymous Types in C# were a massive mistake. They should be [Obsolete]'d, IMO.
- recursive 3y agoThe tuple might be gone by the time the scope ends. I'm aware it's possible to reproduce the behavior without let. The code just looks worse.