C# LINQ basics: query syntax and method syntax
Short answer
LINQ adds query operators to C#. You can write them as query syntax (from/where/select) or as method calls (Where, Select). Both compile to the same operators. [S1][S2]
Forms
var q1 = from n in numbers where n % 2 == 0 select n;
var q2 = numbers.Where(n => n % 2 == 0);
Points
- A LINQ query is a first-class language construct. [S1]
- Any query-syntax query can be written with method syntax. [S1]
- The compiler turns query syntax into standard query operator method calls. [S2]
- Query and method syntax are semantically identical; query syntax is often easier to read. [S2]
Claims
- id: C1 claim: LINQ integrates query capabilities into C#. source: S1 evidence: "integration of query capabilities directly into the C# language"
- id: C2 claim: A query is a first-class language construct. source: S1 evidence: "a query is a first-class language construct"
- id: C3 claim: Query syntax compiles into method calls for standard operators. source: S2 evidence: "The C# compiler translates query syntax into method calls"
- id: C4 claim: Query syntax and method syntax mean the same thing. source: S2 evidence: "Query syntax and method syntax are semantically identical"
Sources
- [S1] Language Integrated Query (LINQ) overview. Microsoft Learn. https://learn.microsoft.com/en-us/dotnet/csharp/linq/ . License: CC BY 4.0 (dotnet/docs). Accessed 2026-11-05.
- [S2] Write LINQ queries in C#. Microsoft Learn. https://learn.microsoft.com/en-us/dotnet/csharp/linq/get-started/write-linq-queries . License: CC BY 4.0 (dotnet/docs). Accessed 2026-11-05.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).
Source notice: .NET documentation © Microsoft. Licensed under Creative Commons Attribution 4.0 International (https://github.com/dotnet/docs/blob/main/LICENSE).
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Microsoft Learn, Language Integrated Query (LINQ) overview, CC BY 4.0 (dotnet/docs); Microsoft Learn, Write LINQ queries in C#, CC BY 4.0 (dotnet/docs).
Cite this
iinventedlight. 2026. "C# LINQ basics: query syntax and method syntax." iinventedlight Library, iil:note:jvpe6zc8, version of 2026-11-04. https://iinventedlight.com/library/notes/csharp-linq-basics/. License: CC-BY-4.0.
@misc{iil_note_jvpe6zc8,
author = {{iinventedlight}},
title = {{C\# LINQ basics: query syntax and method syntax}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-04},
url = {https://iinventedlight.com/library/notes/csharp-linq-basics/},
note = {Permanent ID iil:note:jvpe6zc8. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.
For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/csharp-linq-basics.md.