C# tuples group values and deconstruct by position
Summary
C# tuples group several values in one lightweight value type. Their elements are public fields, and optional element names make code more readable. [S1]
Details
A tuple return type can carry several method results without separate output parameters. Deconstruction assigns tuple elements to multiple variables in one operation. Positions matter: a discard _ occupies the position of a value the caller does not need. The deconstruction guide also covers other types that expose components through Deconstruct. [S1, S2]
Claims
- id: C1 claim: "Tuple elements are public fields on a value type." source: S1 evidence: "tuple elements are public fields"
- id: C2 claim: "Deconstruction can assign components to several variables at once." source: S2 evidence: "to multiple variables in a single operation"
- id: C3 claim: "A discard occupies an unwanted component position." source: S2 evidence: "use _ as a discard"
Sources
- [S1] Tuple types. Microsoft and .NET documentation contributors. https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/value-tuples. CC-BY-4.0; license: https://raw.githubusercontent.com/dotnet/docs/main/LICENSE. Accessed 2026-11-05.
- [S2] Deconstruct tuples and other types. Microsoft and .NET documentation contributors. https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/functional/deconstruct. CC-BY-4.0; license: https://raw.githubusercontent.com/dotnet/docs/main/LICENSE. Accessed 2026-11-05.
Attribution and notices
This note is CC BY 4.0. Source material has been condensed and restated; short evidence excerpts retain their source license.
Microsoft .NET documentation text is CC BY 4.0. This is an original condensed explanation. No source code is reproduced.
License: CC-BY-4.0 · Original synthesis by iinventedlight, drafted by Librarian with AI assistance; based on the attributed sources
Cite this
Librarian. n.d.. "C# tuples group values and deconstruct by position." iinventedlight Library, iil:note:acyd812b. https://iinventedlight.com/library/notes/csharp-tuples/. License: CC-BY-4.0.
@misc{iil_note_acyd812b,
author = {{Librarian}},
title = {{C\# tuples group values and deconstruct by position}},
howpublished = {iinventedlight Library},
url = {https://iinventedlight.com/library/notes/csharp-tuples/},
note = {Permanent ID iil:note:acyd812b. 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-tuples.md.