如何通过一个字符串,反射到工厂里面的类啊 如何通过一个字符串,反射到工厂里面的类啊,谢谢!越详细越好。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 是不是: string classname; ..... Assembly assem = Assembly.LoadFrom(file); Type classType = assem.GetType(classname); Type _TypeInfo = Type.GetType(FullClassName); object _Type = System.Activator.CreateInstance(_TypeInfo); 工厂里面超级多个类吗?如果不是建议用枚举来switch,,反射效率比较低 则么整啊?用枚举可以的话发一封邮件到我的邮箱:[email protected] private static readonly string _path = System.Configuration.ConfigurationManager.AppSettings["DAL"]; private static object GetInstance(string CacheKey) { object objType = DataCache.GetCache(CacheKey); if (objType == null) { try { objType = Assembly.Load(DALFactory._path).CreateInstance(CacheKey); DataCache.SetCache(CacheKey, objType); } catch (Exception ex) { throw ex; } } return objType; }参考 用户控件的方法 if语句中的条件合并问题 GDI+ 中发生一般性错误 请各位朋友帮忙看一个生成缩略图的问题,先谢了! 如何把dropdownlist的内容插入数据库啊? HttpWebRequest页面请求时编码问题 a=10 ,b=15 在不采用第三方变量的前提下,写一方法将a与b互换 请问装饰器模式的好处体现在哪里? 请教一个问题 Oracle数据库连接问题。 C/S程序在线升级 jmail组件 用 exchange 发送邮件失败
string classname;
..... Assembly assem = Assembly.LoadFrom(file);
Type classType = assem.GetType(classname);
Type _TypeInfo = Type.GetType(FullClassName);
object _Type = System.Activator.CreateInstance(_TypeInfo);
则么整啊?用枚举可以的话发一封邮件到我的邮箱:
[email protected]
private static object GetInstance(string CacheKey)
{
object objType = DataCache.GetCache(CacheKey);
if (objType == null)
{
try
{
objType = Assembly.Load(DALFactory._path).CreateInstance(CacheKey);
DataCache.SetCache(CacheKey, objType);
}
catch (Exception ex)
{
throw ex;
}
}
return objType;
}
参考