编写动态加载当前目录下的子目录中的所有dll:s的代码 [英] Write code that dynamicly loads all dll:s from subdirectory below the current directory
本文介绍了编写动态加载当前目录下的子目录中的所有dll:s的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何编写从当前目录下的子目录加载所有dll:s的代码?
还要这样做吗?
//在每个加载的dll中,查找实现IOffer的类
How could i write code that load all dll:s from a subdirectory below the current directory?
And also do this?
// In each loaded dll, look for classes implementing IOffer
推荐答案
Assemby.LoadFile方法:
Assemby.LoadFile methood:
string[] files = Directory.GetFiles("c:\program", "*.dll");
foreach (var file in files)
{
var assembly = Assembly.LoadFile(file);
var types = assembly.GetTypes();
}
这篇关于编写动态加载当前目录下的子目录中的所有dll:s的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文