解决方案 »
- Wince SQLce 数据库连接的怪事
- c# WinForm中,怎样在一个函数未执行完之前,可以执行第二个按钮?
- C#接口继承的问题
- WinForm中关于TreeView的问题,急求
- 求书!有关 C# 用 DX9.0 SDK 做 2D\3D 的书籍!
- C#winform问题希望高手请教!!!!!!!!!!!!·
- C#进阶者对例子里面的几个疑问?
- 修改了TextBox内的值后,为何Updata不回数据库?
- dataset 的大内高手 请用 犀利的眼光 帮俺 查&修两个 错误!
- 遇到的关于session的问题。看如何解决。
- C# VS2012下的WPF项目中如何加载MsChart控件到Xaml中使用??
- 求大神帮改成asp.net(C#)的代码
http://wenku.baidu.com/link?url=CQRFDWzWTS4iVjzJvYrX5Jt8FcCyZcaHsk73XVH1ilKMANLbvMTiyIM0p4wC_T1HhNlz42kFzG9c5eZCwXLfCLmCXP2jgAbxKl0vyrctSHC
public static IPugins LoadDll(string strDllName)
{
if (!Directory.Exists(strPlugin))
Directory.CreateDirectory(strPlugin); string strDllFullName = strDllName;
if (strDllFullName.Substring(strDllFullName.Length - 4) != ".dll")
strDllFullName += ".dll";
else
strDllName = strDllName.Substring(0, strDllName.Length - 4); byte[] inArray = getAppDll(strDllFullName);
if (inArray == null || inArray.Length == 0)
return null; AppDomainSetup AppSetup = new AppDomainSetup();
AppSetup.PrivateBinPath = strPlugin;
AppDomain _appDomain = AppDomain.CreateDomain(Application.ProductName, null, AppSetup);
try
{
_appDomain.AssemblyResolve += new ResolveEventHandler(doOnAssemblyResolve);
ObjectHandle handle = _appDomain.CreateInstance(Convert.ToBase64String(inArray), strDllName + strNamespace);
return (IPugins)handle.Unwrap();
}
catch (Exception ex)
{
_appDomain = null;
try
{
AppDomain.Unload(_appDomain);
}
catch
{
}
_appDomain = null;
throw ex;
}
}