少有人走的路

勇哥的工业自动化技术网站

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);
}
}


发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

«    2025年12月    »
1234567
891011121314
15161718192021
22232425262728
293031
控制面板
您好,欢迎到访网站!
  查看权限
网站分类
搜索
最新留言
文章归档
网站收藏
友情链接

Powered By Z-BlogPHP 1.7.3

Copyright www.skcircle.com Rights Reserved.

鄂ICP备18008319号


站长QQ:496103864 微信:abc496103864