using System; using System.Reflection; public class Foo { } public struct Bar { } public class Test { public static void Func (U u) { Console.WriteLine (u); } } class X { static void Test (Type t, object arg) { MethodInfo mi = t.GetMethod ("Func"); mi.Invoke (null, new object[] { arg }); } public static void Main () { Test (typeof (Test>), new Foo ()); Test (typeof (Test>), new Bar ()); Test (typeof (Test>), new Bar ()); Test (typeof (Test>), new Foo ()); Test (typeof (Test), DateTime.Now); Test (typeof (Test), "Hello"); } }