代码
IWFP_SYS_Bytes mywfpbyte; /**/ byte[] bin=null; using (FileStream fs = new FileStream(filename, FileMode.Open)) { BinaryReader br = new BinaryReader(fs); bin = br.ReadBytes(Convert.ToInt32(fs.Length)); fs.Close(); br.Close(); } Assembly vAssembly = Assembly.Load(bin);// Assembly.LoadFrom(filename); System.Globalization.CultureInfo gcnull = null; object[] objnull = null; Binder binull = null; object vTemp = null; object[] objParm = null;//传递的参数 AppDomain ad = AppDomain.CreateDomain("DLL Unload test"); vTemp = vAssembly.CreateInstance(Classname, true, BindingFlags.Default, binull, objParm, gcnull, objnull); if (vTemp != null) { mywfpbyte = (IWFP_SYS_Bytes)vTemp; mywfpbyte.DBtype = ConfigurationManager.AppSettings["DBtype"]; mywfpbyte.PSQL = ConfigurationManager.AppSettings["PSQL"]; mywfpbyte.WFPCon = WFPCon; isrun = 1; byte[] rebytes= mywfpbyte.WFP_SYS_BytesSQL(args, Param, mpath, myurl, out errorInfo); AppDomain.Unload(ad); mywfpbyte = null; return rebytes; }