I'm trying to find the correct names for these 2 "types" of coding expressions in LINQ so that I can refer to them correctly. I want to say that the first is called "Fluent Style"?
var selectVar = arrayVar.Select( (a,i) => new { Line = a });
var selectVar =
from s in arrayVar
select new { Line = s };
From stackoverflow
Guy
-
- First - calling an extension method. This style of coding is called "fluent interface" as you mentioned.
- Second method is called language integrated query
From aku -
the first isn't even really linq, its a lambda expression, with a type invariant object created. (a) => new { blah = b}
The second is a linq query filling an on the fly class that has a property Line. There is no hashrocket operator in this one, so this one is just plain old linq.
From DevelopingChris -
The name of the second form is "query comprehesion syntax", which the compiler translates into the first form.
From David B
0 comments:
Post a Comment