C# Feature β Tuples
Overview
Section titled βOverviewβTuples group multiple values with names, returning multiple results without custom types.
Introduced In
Section titled βIntroduced InβC# 7 (2017)
class Pair { public int X; public int Y; }(int X, int Y) p = (1, 2);Annotated Example
Section titled βAnnotated Exampleβvar (sum, count) = Aggregate(xs);Gotchas & Best Practices
Section titled βGotchas & Best Practicesβ- Prefer meaningful names for tuple elements.
Related Features
Section titled βRelated FeaturesβVersion Notes
Section titled βVersion Notesβ- Works with deconstruction assignment.