0

In some cases I see LINQ written this way:

L.Select(_ => _.A).Where(...)

and in some other cases, I see this:

A = from B in C where (...)

Do these two syntaxes have different names? I understand both, but they seem to be referred to as LINQ so I am a bit confused.

Thomas
  • 10,933
  • 14
  • 65
  • 136
  • ok, I get it now; when I google something with LINQ, I often find samples with the first style – Thomas Nov 10 '17 at 12:28
  • i mean both could be called _LINQ_ considering they're declarative and similar to SQL queries _in a way_ regardless of the method syntax or query syntax. – Ousmane D. Nov 10 '17 at 12:29
  • 1
    note, though, that the *libraries* and *general approach* **also** (right or wrong) gets labelled as LINQ - so it would also be true to say that *even though* you're not using the "language integrated" part, you're still using LINQ features – Marc Gravell Nov 10 '17 at 12:29
  • The first approach is called lambda syntax and then second one is query syntax – Souvik Ghosh Nov 10 '17 at 12:31
  • @stuard, I realize it is a duplicate of the question you linked; I hadn't found it; you can close this one I guess. Thanks everyone for the answers! – Thomas Nov 10 '17 at 12:32

1 Answers1

2

The first one is Method Syntax or Method extension syntax or Fluent The second one is Query Syntax or Query Expression Syntax

kir.gera
  • 192
  • 1
  • 12