码迷,mamicode.com
首页 > 其他好文 > 详细

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

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

标签:blog   http   io   ar   art   cti   log   ad   

转: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#根据类名称创建类的实例

标签:blog   http   io   ar   art   cti   log   ad   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!