|
|
|
|
|
by SimonB86
5041 days ago
|
|
Regarding the let keyword; the following code: var x = from post in posts
let keywords = post.split(' ')
...
Is compiled* into: var x = posts
.Select(post => new { keywords = post.split(' '), post })
...
* If you didn't know already, the compiler transforms query syntax into extension method syntax. |
|
I worded it badly. I should have been clearer in that I was following on from solutionyogi's argument about readability.
The compiler example is a bit on the ugly side, wouldn't you say? To then access 'keywords', it becomes
What I should have said was that I'm not sure how you would scope things in the same way as the 'let' clause when using extension methods with the same level of readability.