In class/Microsoft.Build.Tasks/Microsoft.Build.Tasks:
[mcs.git] / tests / test-543.cs
blob606b89ad3f1f2304080c8a8d845a9e93185a8826
1 // Compiler options: -r:test-543-lib.dll
3 using System;
5 class BetterMethod
7 public int this[params bool[] args] { get { return 2; } }
8 public string this[bool a, object b] { get { throw new NotImplementedException (); } }
11 class MainClass
13 public int this [int expectedLength, params string[] items]
15 get { return 4; }
16 set {
17 if (expectedLength != items.Length)
18 throw new ArgumentException (expectedLength + " != " + items.Length);
22 public object this [int expectedLength, params object[] items]
24 get { return null; }
25 set {
26 if (expectedLength != items.Length)
27 throw new ArgumentException (expectedLength + " != " + items.Length);
31 public bool this [int expectedLength, bool isNull, params object[] items]
33 get { return false; }
34 set {
35 if (expectedLength != items.Length)
36 throw new ArgumentException (expectedLength + " != " + items.Length);
40 static void Main(string[] args)
42 MainClass t = new MainClass();
43 t [2, "foo", "doo"] = 2;
44 t [3, new object[3]] = null;
45 t [2, new int[] { 1 }, new string[] { "c", "b", "a" }] = null;
46 t [0, true] = t [0, true];
47 t [1, false, "foo"] = t [0, false, "foo", "doo"];
49 ExternClass e = new ExternClass ();
50 e ["a", "b", "b"] = false;
52 BetterMethod bm = new BetterMethod ();
53 Console.WriteLine (bm[true, false]);