← All notes

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

Claims

Sources

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

Permanent ID: iil:note:jvpe6zc8

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.},
}

Markdown

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.