use MOONLIGHT symbol
[mcs.git] / tests / dtest-005.cs
blobd6156bb1811437147f50815d13cbc3f9fba9fb36
1 using System;
2 using System.Dynamic;
4 public class MyObject : DynamicObject
6 public static int Get, Invoke;
8 public override bool TryGetMember (GetMemberBinder binder, out object result)
10 Console.WriteLine ("Get");
11 Get++;
12 result = null;
13 return true;
16 public override bool TryInvokeMember (InvokeMemberBinder binder, object[] args, out object result)
18 Console.WriteLine ("Invoke");
19 Invoke++;
20 result = null;
21 return true;
25 public class Tests
27 public static int Main ()
29 dynamic d = new MyObject ();
31 var g = d.GetMe;
32 if (MyObject.Get != 1 && MyObject.Invoke != 0)
33 return 1;
35 d.printf ("Hello, World!");
36 if (MyObject.Get != 1 && MyObject.Invoke != 1)
37 return 2;
39 Console.WriteLine ("ok");
40 return 0;