News for hackers. Stuff that matters.
Re:Best Practices for Linq Enumerables and Queryables by SimonB86 on Friday August 24, 2012 @11:24AM (#4427994)
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.
Re:Best Practices for Linq Enumerables and Queryables by upthedale on Friday August 24, 2012 @11:40AM (#4428089)
Oh yes, I did actually realise that. Thank you though.

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

  ...
  .Where(anon => anon.keywords[0] == "verybadexample")
  .Select(anon => anon.post);
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.
Re:Best Practices for Linq Enumerables and Queryables by andy_t on Friday August 24, 2012 @12:39PM (#4428324)
Like this:

  var thing = 
    from x in stuff
    let derp = x.herp
    select { x.name }
Equals this:

  var thing = stuff.Select( x => {
    var derp = x.herp;

    return new { x.name };
  } );
edit: formatting.

I think each have their place, but this absolutely enrages me:

  var things = ( from x in thingList select x ).ToList()