What's elegant way to rewrite following LINQ statement using extension methods?

Posted by Jakub Šturc on Stack Overflow See other posts from Stack Overflow or by Jakub Šturc
Published on 2010-03-30T09:11:37Z Indexed on 2010/03/30 9:33 UTC
Read the original article Hit count: 349

Filed under:
|
|
|

I have following LINQ statement and I want to rewrite it using extension methods.

from x in e
from y in e
from z in e
select new { x, z }

One possible solution is:

e.Join(e, x => 42, y => 42, (x, y) => new { x, y })
  Join(e, _ => 42, z => 42, (_, z) => new { _.x, z }); 

However this is everything but elegant.

Do you any idea how to improve beauty of second expression?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#