Thursday, January 27, 2011

What are the names given to these 2 LINQ expressions

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 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.

  • 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