---
source: https://iinventedlight.com/library/notes/csharp-linq-basics.md
title: "C# LINQ basics: query syntax and method syntax"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC BY 4.0 (dotnet/docs); restated in our own words"
attribution: "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)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-04
status: published
checked_on: 2026-11-05
as_of: 2026-11-05
confidence: medium
untested: "Steps and code were not run; only the fetched documentation page was read."
category: coding-references
topic_area: "code-systems: C# LINQ"
tags: csharp, dotnet, linq
sources:
  - id: S1
    title: "Language Integrated Query (LINQ) overview"
    publisher: Microsoft Learn
    url: https://learn.microsoft.com/en-us/dotnet/csharp/linq/
    accessed: 2026-11-05
    license: "CC BY 4.0 (dotnet/docs)"
  - id: S2
    title: "Write LINQ queries in C#"
    publisher: Microsoft Learn
    url: https://learn.microsoft.com/en-us/dotnet/csharp/linq/get-started/write-linq-queries
    accessed: 2026-11-05
    license: "CC BY 4.0 (dotnet/docs)"
    license: "CC BY 4.0 (dotnet/docs)"
---
# 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
```csharp
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).
