[LoongArch64] Part-5:add loongarch support in some files for LoongArch64. (#21769)
[mono-project.git] / mcs / tests / test-expression-bodied-01.cs
blob6d827f21ed691440f1a6840eace31acd4d04fe76
1 using System;
3 class C
5 int value;
6 string f1 = "f-1";
7 string f2 = "f=2";
9 public static string Test1 (string a, string b) => a + "|" + b;
10 void Test2 (int x) => value = x;
11 Func<int> Test3 (int a) => () => a;
13 public static implicit operator string (C c) => "op";
15 protected string Prop => f1 + " " + f2;
16 static Func<string> Prop2 => () => "n1";
18 public int this[int arg1, int arg2] => arg2 - arg1;
21 int Check ()
23 if (Test1 ("1", "5") != "1|5")
24 return 1;
26 Test2 (6);
27 if (value != 6)
28 return 2;
30 if (Test3 (9) () != 9)
31 return 3;
33 string s = this;
34 if (s != "op")
35 return 4;
37 if (Prop != "f-1 f=2")
38 return 5;
40 if (Prop2 () != "n1")
41 return 6;
43 if (this [13, 20] != 7)
44 return 7;
46 return 0;
49 static int Main()
51 var c = new C ();
52 return c.Check ();