So basically.. What is the difference of these two lines? And are these lines compiling to the same CIL?
There's just two different ways to write the same thing. The lambda syntax is newer and more concise, but they do the same thing (in this case).
Note that lambdas (=>
syntax) can also be used to form Expression Lambdas, where you make an Expression Tree instead of a delegate. This is nice since you can use the same syntax whether you're using LINQ to Objects (which is based around delegates like Func
) or LINQ to Entities (which uses IQueryable
and expression trees).