62,046
社区成员
发帖
与我相关
我的任务
分享
/// <summary>
/// 得到实现类
/// </summary>
/// <param name="usingstr">实现类的命名空间</param>
/// <param name="classname">实现类的类名 </param>
/// <returns>实现类 要强转成接口</returns>
public static object GetAchieve(string usingstr, string classname)
{
object obj = new object();
Assembly assembly = Assembly.GetExecutingAssembly(); // 获取当前程序集
try
{
obj = assembly.CreateInstance(usingstr + "." + classname);
if (obj == null)
{
string _strFilePath = System.IO.Path.GetDirectoryName(HttpContext.Current.Request.PhysicalApplicationPath) + "//bin//";
assembly = Assembly.LoadFile(_strFilePath + usingstr + ".DLL"); // 加载程序集(EXE 或 DLL)
obj = assembly.CreateInstance(usingstr + "." + classname); // 创建类的实例
}
}
catch { }
return obj;
}
BSI bi2 = (BSI)(TaskAPP.BLL.h_ast_repair)obj