using System;
namespace 튜플해체
{
class Point
{
public int X { get; }
public int Y { get; }
public Point(int x, int y)
{
X = x;
Y = y;
}
public void Deconstruct(out int x, out int y)
{
x = X;
y = Y;
}
}
public class 튜플해체
{
static void Main(string[] args)
{
var point = new Point(100, 200); // 좌표: (100, 200)
var (x, y) = point;
Console.WriteLine($"좌표: ({x}, {y})");
}
}
}
좌표: (100, 200)
계속하려면 아무 키나 누르십시오 . . .