diff options
author | Marek Safar <marek.safar@gmail.com> | 2008-06-22 13:48:50 +0400 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2008-06-22 13:48:50 +0400 |
commit | 1bb520c60668f24e7b454b9d866d0968aa6e3543 (patch) | |
tree | 2ed851b0e9873be0eb5ccbdaf63a0a11b6280696 /mcs/tests/test-anon-76.cs | |
parent | 7e61f7ddaf1aba70d9be33f7914a129ba9c969d8 (diff) |
2008-06-22 Marek Safar <marek.safar@gmail.com>
A test for bug #394347
svn path=/trunk/mcs/; revision=106367
Diffstat (limited to 'mcs/tests/test-anon-76.cs')
-rwxr-xr-x | mcs/tests/test-anon-76.cs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/mcs/tests/test-anon-76.cs b/mcs/tests/test-anon-76.cs new file mode 100755 index 00000000000..c9bcf1f12cc --- /dev/null +++ b/mcs/tests/test-anon-76.cs @@ -0,0 +1,39 @@ +using System;
+
+delegate object FactoryDelegate ();
+
+public class C
+{
+ FactoryDelegate var;
+ int counter;
+
+ FactoryDelegate this [string s]
+ {
+ set { var = value; }
+ get { return var; }
+ }
+
+ public void X ()
+ {
+ this ["ABC"] = delegate () {
+ ++counter;
+ Console.WriteLine ("A");
+ return "Return";
+ };
+ }
+
+ static int Main ()
+ {
+ C o = new C ();
+ o.X ();
+
+ Console.WriteLine ("B");
+ Console.WriteLine (o ["ABC"] ());
+
+ Console.WriteLine (o.counter);
+ if (o.counter != 1)
+ return 1;
+
+ return 0;
+ }
+}
|