2010-06-17 Geoff Norton <gnorton@novell.com>
[mono.git] / mono / tests / generic-virtual-invoke.2.cs
blob909d4741dd1fabcc8e04300fe5beb615bb70057a
1 using System;
2 using System.Reflection;
4 public abstract class Base {
5 public abstract object virt<T> ();
8 public class Derived : Base {
9 public override object virt<T> () {
10 return new T [3];
14 public class ClassA {}
16 public class main {
17 public static int Main () {
18 Base b = new Derived ();
20 MethodInfo method = typeof (Base).GetMethod ("virt");
21 Type [] arg_types = { typeof (object), typeof (string), typeof (ClassA),
22 typeof (Base), typeof (Derived) };
23 Type [] array_types = { typeof (object []), typeof (string []), typeof (ClassA []),
24 typeof (Base []), typeof (Derived []) };
26 for (int j = 0; j < 100; ++j)
27 for (int i = 0; i < arg_types.Length; ++i)
29 Type [] args = { arg_types [i] };
30 MethodInfo inflated = method.MakeGenericMethod (args);
32 if (inflated.Invoke (b, null).GetType () != array_types [i])
33 return 1;
36 return 0;