1. 根据类型实例化对象

//Type tp;

object o = Activator.CreateInstance(tp);

view = o as View;

 

2.根据类名称的字符串实例化对象

//Type tp;

Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();

object o3 = asm.CreateInstance(tp.ToString());

view = o3 as View;

 

相关文章:

猜你喜欢
相关资源
相似解决方案