C# Type传参转换成泛型T

public class Test{
   public void Export<T1, T2>()
    {
      
    }
 
 
    public void ExportByClassName(string typename1,string typename2)
    {
        Type t1 = Type.GetType(typename1);
        Type t2 = Type.GetType(typename2);
        MethodInfo mi = this.GetType().GetMethod("Export").MakeGenericMethod(new Type[] { t1,t2});
        mi.Invoke(this,null);
    }
}

https://blog.csdn.net/fgfg12345/article/details/45098639

posted on 2023-06-13 11:58  糯米白白  阅读(374)  评论(0编辑  收藏  举报

导航