CSharp examples for Language Basics:Tuple
Assign two value in one statement with Tuple
using System;//from w ww.ja v a2 s . c om using System.ComponentModel; public sealed class Point { public double X { get; } public double Y { get; } public Point(double x, double y) => (X, Y) = (x, y); public void Deconstruct(out double x, out double y) => (x, y) = (X, Y); } class PointDeconstruction { static void Main() { var point = new Point(1.5, 20); var (x, y) = point; Console.WriteLine($"x = {x}"); Console.WriteLine($"y = {y}"); } }