积极答复者
自定义类型在库类间传递失败

问题
-
exe文件和dll文件 都包含了一个 bkin.cs
namespace bkcomein
{class rece
{
public string strInvNo = "";
public string strRcbCur = "";
public string strRcbAmt = "";
}class bk
{
public string bkno="";public ArrayList receArr = new ArrayList();
}}
在 dll 里有函数
public class cshareap
{public void GetInfo(ArrayList jobarr)
{
bk booking = new bk();for (int i = 0; i < jobarr.Count; i++)
{
booking = (bk)jobarr[0];string strno = booking.bkno;
}
}}
在exe的按钮事件里
private void ap_Click(object sender, EventArgs e)
{ArrayList jobarr = new ArrayList();
bk booking = new bk();rece m_rece = new rece();
m_rece.strInvNo = "inv";
m_rece.strRcbAmt = "1000";
m_rece.strRcbCur = "HKD";
booking.receArr.Add(m_rece);jobarr.Add(booking);
cshareap ap = new cshareap();
ap.GetInfo(jobarr);
}
运行结果是 在 dll 的
booking = (bk)jobarr[0]; 这句出错
信息是:无法将类型为“bkinfo.bk”的对象强制转换为类型“bkinfo.bk”