2009-03-11 Zoltan Varga <vargaz@gmail.com>
[mcs.git] / tests / test-anon-76.cs
blobee50eba347f8a842cc2635ecc11e9bd2b7cbcf34
1 using System;
3 delegate object FactoryDelegate ();
5 public class C
7 FactoryDelegate var;
8 int counter;
10 FactoryDelegate this [string s]
12 set { var = value; }
13 get { return var; }
16 public void X ()
18 this ["ABC"] = delegate () {
19 ++counter;
20 Console.WriteLine ("A");
21 return "Return";
25 static int Main ()
27 C o = new C ();
28 o.X ();
30 Console.WriteLine ("B");
31 Console.WriteLine (o ["ABC"] ());
33 Console.WriteLine (o.counter);
34 if (o.counter != 1)
35 return 1;
37 return 0;