Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-581.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cc0a542aa1c4218a38dbb87e4608f142eed103f9 (plain)
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
using System;

public class TestParams
{
	object this [params string[] idx] {
		get {
			return idx[0];
		}
		set {
			Console.WriteLine (value);
			if ((string)value != "A(B)")
				throw new ApplicationException (value.ToString ());
		}
	}
	
	public void TestMethod ()
	{
		this ["A"] += "(" + this ["B"] + ")";
		this [new string[] {"A"}] += "(" + this ["B"] + ")";
	}
}

public class TestNonParams
{
	object this [string idx] {
		get {
			return idx;
		}
		set {
			Console.WriteLine (value);
			if ((string)value != "A(B)")
				throw new ApplicationException (value.ToString ());
		}
	}
	
	public void TestMethod ()
	{
		this ["A"] += "(" + this ["B"] + ")";
	}
}

public class M
{
	public static int Main()
	{
		new TestNonParams().TestMethod ();
		new TestParams().TestMethod ();
		return 0;
	}
}