News for hackers. Stuff that matters.
Re:Net 9.0 LINQ Performance Improvements by apwell23 on Friday October 18, 2024 @09:31AM (#41879292)
LINQ = Language Integrated Query

Its even in the name. What do you mean by "method chaining is linq" ?

Re:Net 9.0 LINQ Performance Improvements by ygra on Friday October 18, 2024 @09:37AM (#41879342)
Considering the methods live in the System.Linq namespace, I think the extension methods may also be called LINQ.
Re:Net 9.0 LINQ Performance Improvements by high_na_euv on Friday October 18, 2024 @09:40AM (#41879380)
"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

Re:Net 9.0 LINQ Performance Improvements by apwell23 on Friday October 18, 2024 @09:54AM (#41879493)
> But yea, it is LINQ method chaining.

You mean like 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 .

Re:Net 9.0 LINQ Performance Improvements by high_na_euv on Friday October 18, 2024 @09:57AM (#41879518)
>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

Re:Net 9.0 LINQ Performance Improvements by Merad on Friday October 18, 2024 @04:01PM (#41882948)
LINQ 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.