110,534
社区成员
发帖
与我相关
我的任务
分享
/// <summary>
/// 返回指定dll下的类
/// </summary>
/// <param name="clsName">泛型类名(GridViewOperate)</param>
/// <param name="entityName">实体类名(VersionInfo)</param>
/// <param name="m_Assembly">泛型类</param>
/// <returns></returns>
static object ActivetorMethodOutObject(string clsName,string entityName,Assembly m_Assembly)
{
object _result = null;
try
{
string _tmpCls = "Platform." + clsName+"<"+entityName+">";//Platform是dll文件的名字(换成你的VersionInfo所在的dll文件即可)
Type _CurrentType = m_Assembly.GetType(_tmpCls, false);
_result = Activator.CreateInstance(_CurrentType);
}
catch { }
return _result;
}
//返回指定dll下的类
static object ActivetorMethodOutObject(string clsName,Assembly m_Assembly)
{
object _result = null;
try
{
string _tmpCls = "Platform." + clsName;//Platform是dll文件的名字(换成你的VersionInfo所在的dll文件即可)
Type _CurrentType = m_Assembly.GetType(_tmpCls,false);
_result = Activator.CreateInstance(_CurrentType);
}
catch { }
return _result;
}
Assembly m_Assembly = Assembly.LoadFrom(str);//载入装配件
//返回指定dll下的类
static object ActivetorMethodOutObject(string clsName,Assembly m_Assembly)
{
object _result = null;
try
{
string _tmpCls = "Platform." + clsName;
Type _CurrentType = m_Assembly.GetType(_tmpCls,false);
_result = Activator.CreateInstance(_CurrentType);
}
catch { }
return _result;
}