转:http://blog.csdn.net/ise_keven1/article/details/2070049
方案一:
using System;
using System.Reflection;
Type type = Type.GetType("abc");
Activator.CreateInstance(type);
方案二:
using System;
using System.Reflection;
Assembly assem = Assembly.Load("dll名称");
Type helloType = assem.GetType("类名");
Object obj = Activator.CreateInstance(helloType);
C#根据类名称创建类的实例
时间: 2024-10-07 10:28:50