C# Feature β Deconstruction
Overview
Section titled βOverviewβDeconstruction syntax assigns multiple values in one statement from tuples or types with Deconstruct methods.
Introduced In
Section titled βIntroduced InβC# 7 (2017)
var t = GetPoint();var x = t.X; var y = t.Y;var (x, y) = GetPoint();Annotated Example
Section titled βAnnotated Exampleβpublic readonly struct Point(int x, int y){ public int X { get; } = x; public int Y { get; } = y;}Gotchas & Best Practices
Section titled βGotchas & Best Practicesβ- Ensure Deconstruct methods are in scope.
Related Features
Section titled βRelated FeaturesβVersion Notes
Section titled βVersion Notesβ- Extended patterns support richer deconstruction cases.