首页 > 其他 > 详细

从用户控件中动态加载程序集

时间:2020-07-23 02:17:13      阅读:127      评论:0      收藏:0      [点我收藏+]
Assembly assembly = null;
string windowsPath = Path.Combine(Application.StartupPath, "Windows");
 
foreach (string dllFile in Directory.GetFiles(windowsPath, "*.dll"))
{
     assembly = Assembly.LoadFile(dllFile);
     Type[] types = assembly.GetTypes();
     foreach (Type t in types)
     {
          //增加你的代码
     }
}

结合DesigerHost可以实现类似VS动态加载控件

技术分享图片

 

从用户控件中动态加载程序集

原文:https://www.cnblogs.com/zhaogaojian/p/13363624.html

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