linq "let" translation

Posted by luke on Stack Overflow See other posts from Stack Overflow or by luke
Published on 2010-06-09T01:14:01Z Indexed on 2010/06/09 1:22 UTC
Read the original article Hit count: 254

Filed under:
|

I understand that when the C# compiler sees a linq query comprehension, it basically does a straight translation to the corresponding Linq Extension methods and lambdas. i.e.

from x in list
select x.property

gets translated to:

list.Select(x => x.property)

my question is what do let clauses get translated to. for example how would this get translated by the compiler.

from x in list
let v = SomeComplexExpressionDependingOnx
select v

(p.s. i know this could be reduced to just select SomeComplexExpressionDependingOnx but i want to know how this is done in general)

Thanks!

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ