3 ms·
To be fair, 99% of linq usage is method chaining syntax, not query syntax
by high_na_euv 2y ago
To be fair, 99% of linq usage is method chaining syntax, not query syntax
- apwell23 2y agoLINQ = Language Integrated Query Its even in the name. What do you mean by "method chaining is linq" ?
- ygra 2y agoConsidering the methods live in the System.Linq namespace, I think the extension methods may also be called LINQ.
- high_na_euv 2y ago"var results = list.Where(x => x.Salary > 12345).Select(x => x.Name).ToList())" Giant majority of ppl refers to this when talking about LINQ. But yea, it is LINQ method chaining. SQL like syntax is LINQ query syntax
- apwell23 2y ago> But yea, it is LINQ method chaining. You mean like fluent interface? https://en.wikipedia.org/wiki/Fluent_interface https://en.wikipedia.org/wiki/Fluent_interface What does this have to do with LINQ or C#. I remember doing 'method chaining' in 1990s .
- high_na_euv 2y ago>fluent interface Various names, same concept. "fluent interface is an object-oriented API whose design relies extensively on method chaining." >What does this have to do with LINQ or C#. Check the name of the namespace where all those APIs like Where, GroupBy, etc. are implemented, it is "System.Linq" So thats why majority of ppl think about them when talking about LINQ. Query syntax has like less than 1% of the "market share" versus method chaining style
- Merad 2y agoLINQ is the name for the overall system. LINQ can be written using two different styles: // Method syntax var evenNumbers = numbers.Where(num => num % 2 == 0).OrderBy(n => n); // Query syntax var evenNumbers = from num in numbers where num % 2 == 0 orderby num select num; Method syntax and query syntax are both part of LINQ (query syntax is syntactic sugar). .Net developers tend to overwhelmingly prefer method syntax.