File: test-expression-bodied-01.cs

package info (click to toggle)
mono 4.6.2.7%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 778,148 kB
  • ctags: 914,052
  • sloc: cs: 5,779,509; xml: 2,773,713; ansic: 432,645; sh: 14,749; makefile: 12,361; perl: 2,488; python: 1,434; cpp: 849; asm: 531; sql: 95; sed: 16; php: 1
file content (54 lines) | stat: -rw-r--r-- 826 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;

class C
{
	int value;
	string f1 = "f-1";
	string f2 = "f=2";

	public static string Test1 (string a, string b) => a + "|" + b;
	void Test2 (int x) => value = x;
	Func<int> Test3 (int a) => () => a;

	public static implicit operator string (C c) => "op";

	protected string Prop => f1 + " " + f2;
	static Func<string> Prop2 => () => "n1";

	public int this[int arg1, int arg2] => arg2 - arg1;


	int Check ()
	{
		if (Test1 ("1", "5") != "1|5")
			return 1;

		Test2 (6);
		if (value != 6)
			return 2;

		if (Test3 (9) () != 9)
			return 3;

		string s = this;
		if (s != "op")
			return 4;

		if (Prop != "f-1 f=2")
			return 5;

		if (Prop2 () != "n1")
			return 6;

		if (this [13, 20] != 7)
			return 7;

		return 0;
	}

    static int Main()
    {
    	var c = new C ();
        return c.Check ();
    }
}