Query Syntax

noun

say it: “KWEER-ee SIN-taks” /ˈkwɪəri ˈsɪntæks/

Writing a LINQ query with SQL-like keywords: from, where, orderby and select.

What is Query Syntax in C#?

Query Syntax — Writing a LINQ query with keywords that read like SQL: from, where, orderby, select. The compiler turns it into the same method calls as method syntax, so pick whichever reads better.

var cheap = from p in products
            where p.UnitPrice < 10m
            orderby p.ProductName
            select p.ProductName;

In a sentence

  • “In query syntax, the filter reads from p in products where p.UnitPrice < 10 select p.”

Level: Journeyman · More C# terms at this level

Updated