You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.22
Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
parent
5f4a27cc8a
commit
7d05485754
71
mcs/tests/test-tuple-03.cs
Normal file
71
mcs/tests/test-tuple-03.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
class TupleDeconstruct
|
||||
{
|
||||
static int s_xx;
|
||||
static long s_yy;
|
||||
|
||||
public static int Main ()
|
||||
{
|
||||
var (xx, yy) = (1, 2);
|
||||
if (xx != 1)
|
||||
return 1;
|
||||
|
||||
if (yy != 2)
|
||||
return 2;
|
||||
|
||||
int x, y;
|
||||
(x, y) = (1, 2);
|
||||
if (x != 1)
|
||||
return 3;
|
||||
|
||||
if (y != 2)
|
||||
return 4;
|
||||
|
||||
(s_xx, s_yy) = Test3 ();
|
||||
if (s_xx != 1)
|
||||
return 5;
|
||||
|
||||
if (s_yy != 3)
|
||||
return 6;
|
||||
|
||||
// var cwd = new ClassWithDeconstruct ();
|
||||
// var (m1, m2) = cwd;
|
||||
|
||||
// (string, string) ss = cwd; // Error
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void Test2 ()
|
||||
{
|
||||
var c = new C ();
|
||||
(c.Prop1, c.Prop2) = (1, 2);
|
||||
}
|
||||
|
||||
static (int, long) Test3 ()
|
||||
{
|
||||
return (1, 3);
|
||||
}
|
||||
|
||||
static void TestCustom ()
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
class ClassWithDeconstruct
|
||||
{
|
||||
public void Deconstruct (out string f, out string s)
|
||||
{
|
||||
f = "a";
|
||||
s = "z";
|
||||
}
|
||||
}
|
||||
|
||||
class C
|
||||
{
|
||||
public int Prop1 { get; set; }
|
||||
public int Prop2 { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user