New test.
[mono.git] / mono / tests / runtime-invoke.cs
1 using System;
2 using System.Reflection;
3
4 public struct A
5 {
6         public override string ToString ()
7         {
8                 return "A";
9         }
10 }
11
12 public class D
13 {
14         public string Test ()
15         {
16                 return "Test";
17         }
18 }
19
20 class X
21 {
22         static void Main ()
23         {
24                 Assembly ass = Assembly.GetCallingAssembly ();
25                 Type a_type = ass.GetType ("A");
26                 MethodInfo a_method = a_type.GetMethod ("ToString");
27
28                 Type d_type = ass.GetType ("D");
29                 MethodInfo d_method = d_type.GetMethod ("Test");
30
31                 Console.WriteLine ("TEST: {0} {1}", a_method, d_method);
32
33                 A a = new A ();
34                 D d = new D ();
35
36                 object a_ret = a_method.Invoke (a, null);
37                 Console.WriteLine (a_ret);
38
39                 object d_ret = d_method.Invoke (d, null);
40                 Console.WriteLine (d_ret);
41         }
42 }