求助

问大家一个问题 这个函数的用法。
Assembly.Load (Byte[])

我有两个 Assembly  ,ClassLibrary1和ClassLibrary2 其中
ClassLibrary2引用了ClassLibrary1。

我在ClassLibrary2中 创建了一个ClassLibrary1中的类实例。

具体如下:

 我在一个程序中,通过如下代码 调用 ClassLibrary2

   System.IO.FileStream fs = System.IO.File.Open(@"D:\ClassLibrary2\bin\Debug\ClassLibrary1.dll",System.IO.FileMode.Open,System.IO.FileAccess.Read);
   Byte[] cl1 = new byte[fs.Length];
   fs.Read(cl1, 0, System.Convert.ToInt32(fs.Length));
   fs.Close();
            System.Reflection.Assembly ass1 = System.Reflection.Assembly.Load(cl1);

   System.IO.FileStream fs2 = System.IO.File.Open(@"D:\学习练习\2003 QISystem\ClassLibrary2\bin\Debug\ClassLibrary2.dll",System.IO.FileMode.Open,System.IO.FileAccess.Read);
   Byte[] cl2 = new byte[fs2.Length];
   fs2.Read(cl2, 0, System.Convert.ToInt32(fs2.Length));
   fs2.Close();             

   
   System.Reflection.Assembly ass = System.Reflection.Assembly.Load(cl2);
   System.Windows.Forms.Form ff = ass.CreateInstance("ClassLibrary2.Form1") as System.Windows.Forms.Form;            
   ff.Show();

然后在,ClassLibrary2 中通过如下代码 调用ClassLibrary1

    ClassLibrary1.Class1 ff = new ClassLibrary1.Class1();
       MessageBox.Show(ff.ff.ToString());

并且在这里报错。

大家帮我看看。

 我想了好久,没法解决。这次我放在首页,过几天我拿掉。

谢谢

转载于:https://www.cnblogs.com/zdq2601/archive/2007/08/03/841954.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值