public static T Instance<T>(string assembly, string type)
{
if (string.IsNullOrEmpty(type)) throw new ArgumentException("type:参数不能为空!");
//1、获取有效的程序集
Assembly mAssembly = string.IsNullOrEmpty(assembly) ? Assembly.GetCallingAssembly() : Assembly.Load(assembly);
var t = (T) mAssembly.CreateInstance(type); //创建实例
return t;
}
{
if (string.IsNullOrEmpty(type)) throw new ArgumentException("type:参数不能为空!");
//1、获取有效的程序集
Assembly mAssembly = string.IsNullOrEmpty(assembly) ? Assembly.GetCallingAssembly() : Assembly.Load(assembly);
var t = (T) mAssembly.CreateInstance(type); //创建实例
return t;
}