class Program
{
static void Main(string[] args)
{
Func<object> func = Test1.GetNew;
MethodInfo method = typeof(Test2<>).GetMethod("GetNew");
//TODO 如何使用method定义一个Func<T>
Console.ReadLine();
}
}
class Test1
{
public static object GetNew()
{
return (new Test1()) as object;
}
}
class Test2<T>
{
public static T GetNew()
{
return default(T);
}
}
啥意思?
用emit可以实现.
Func<object> func2 = Test2<object>.GetNew;