首页 > 其他 > 详细

C#根据类名称创建类的实例

时间:2014-08-18 18:00:22      阅读:384      评论:0      收藏:0      [点我收藏+]

转: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#根据类名称创建类的实例,布布扣,bubuko.com

C#根据类名称创建类的实例

原文:http://www.cnblogs.com/bluemaplestudio/p/3919859.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!