Esempio n. 1
0
 public static void Deconstruct(this MyRectangle rect, out string name, out double area, out double width, out double height)
 {
     name   = rect.Name;
     area   = rect.Area;
     width  = rect.Width;
     height = rect.Height;
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            MyRectangle rect = new MyRectangle()
            {
                Width = 10, Height = 30
            };

            (double x, double y) = rect;

            (string name, double a, double d, double f) = rect;

            Console.WriteLine($"{x} -- {y}");

            (new MyRectangle()
            {
                Width = 5, Height = 8
            }).Deconstruct(out double w, out double h);
            Console.WriteLine($"{w} -- {h}");
        }