LINQ vs Methodized Syntax

Recently we had a debate about which way we prefer to see Linq syntax written.  In the LINQ from/select syntax below:

Linq Code

Or, in the Methodized syntax which follows:

Methodized Syntax

I personally prefer the more methodized syntax where it can be used typically (esspecially when the statement contains only a simple where clause).  However it is worth noting that the Join method which takes in four seperate parameters is quite painful to write against, the inferred generics do not properly pick up what you are working with until you finish the entire statement.  I threw together a more "english friendly" syntax which also has the added benefit of allowing generics to properly infer at each step of the way.

Finished Syntax

Now granted some people will argue this syntax takes up "more lines", you could put some of these method calls onto one line if you felt it really necessary.  I've included the small sample of source code which you can get here.

Print | posted @ Monday, March 03, 2008 1:41 AM

Comments on this entry:

Gravatar # re: LINQ vs Methodized Syntax
by Matt Casto at 3/4/2008 1:30 PM

I'd disagree with you if I could read your code.
Gravatar # re: LINQ vs Methodized Syntax
by Dan Shultz at 3/4/2008 2:25 PM

Nice... I may be able to apply it to the Region/Jurisdiction feature.

And I'm with Matt on the readability...I need an Excedrin now.
Gravatar # re: LINQ vs Methodized Syntax
by Kris Scott at 3/4/2008 3:17 PM

Yeah, it looked a lot better when I took the screen shots, I'm going to try moving to a CSS style code pasting utility. Should help.

Your comment:

Title:
Name:
Email:
Website:
 
Italic Underline Blockquote Hyperlink
 
 
Please add 3 and 2 and type the answer here: