[mcs] C# 7 tuple (foundation only).
[mono.git] / mcs / tests / test-tuple-03.cs
1 using System;
2 using System.Linq.Expressions;
3
4 class TupleDeconstruct
5 {
6         public static int Main ()
7         {
8 //              var (xx, yy) = (1, 2);
9 //              if (xx != 1)
10 //                      return 1;
11
12 //              if (yy != 2)
13 //                      return 2;
14
15                 int x, y;
16                 (x, y) = (1, 2);
17                 if (x != 1)
18                         return 1;
19
20                 if (y != 2)
21                         return 2;
22
23 //              var (l1, l2) = ('a', 'b');
24
25 //              var cwd = new ClassWithDeconstruct ();
26 //              var (m1, m2) = cwd;
27
28 //              (string, string) ss = cwd; // Error
29
30                 return 0;
31         }
32
33         static void Test2 ()
34         {
35                 var c = new C ();
36                 (c.Prop1, c.Prop2) = (1, 2);
37         }
38
39         static void var1 (object o1, object o2)
40         {
41         }
42
43         static void TestCustom ()
44         {
45                 return;
46         }
47 }
48
49 class ClassWithDeconstruct
50 {
51         public void Deconstruct (out string f, out string s)
52         {
53                 f = "a";
54                 s = "z";
55         }
56 }
57
58 class C
59 {
60         public int Prop1 { get; set; }
61         public int Prop2 { get; set; }
62 }