2 using System
.Reflection
;
6 public struct SimpleStruct
{
10 public SimpleStruct (bool arg
) {
16 public static void Foo(ref int x
, ref int y
)
22 public static int Main (string[] args
) {
23 return TestDriver
.RunTests (typeof (Tests
), args
);
26 public static int test_0_byref_null () {
27 // Test that the objects for byref valuetype arguments are
28 // automatically created
29 MethodInfo m3
= typeof(Tests
).GetMethod("Foo");
31 var args
= new object[2];
33 m3
.Invoke(null, args
);
35 if ((((int)(args
[0])) != 20) || (((int)(args
[1])) != 30))
41 public static int test_0_ctor_vtype () {
42 // Test the return value from ConstructorInfo.Invoke when a precreated
45 SimpleStruct ss
= new SimpleStruct ();
49 ConstructorInfo ci
= typeof (SimpleStruct
).GetConstructor (new Type
[] { typeof (bool) }
);
50 ci
.Invoke (ss
, new object [] { false }
);
55 public static int test_0_array_get_set () {
56 // Test invoking of the array Get/Set methods
57 string[,] arr
= new string [10, 10];
59 arr
.GetType ().GetMethod ("Set").Invoke (arr
, new object [] { 1, 1, "FOO" }
);
60 string s
= (string)arr
.GetType ().GetMethod ("Get").Invoke (arr
, new object [] { 1, 1 }
);
67 public static int test_0_string_ctor_sharing () {
68 // Test the sharing of runtime invoke wrappers for string ctors
69 typeof (string).GetConstructor (new Type
[] { typeof (char[]) }
).Invoke (null, new object [] { new char [] { 'a', 'b', 'c' }
});
71 typeof (Assembly
).GetMethod ("GetType", new Type
[] { typeof (string), }
).Invoke (typeof (int).Assembly
, new object [] { "A" }
);