我以ArrayList
的形式将数据从Windows窗体发送到Web服务。在我的方法的Web服务的声明是这样的:方法有一些无效的参数?
[WebMethod]
public int SaveSelectedOffers(ArrayList offers, int selectedRows)
{
}
,并在Windows窗体,按钮上点击,我的代码是:
private void offersAvailableSubmit_Click(object sender, EventArgs e)
{
ArrayList options;
options.Add("item 1");
options.Add("item 2");
options.Add("item 2");
//In this line of code it is showing error that Argument 1: cannot convert from 'System.Collections.ArrayList' to 'object[]'
int rowsAffected = serviceCaller.SaveSelectedOffers(options, rowCount);
}
数据类型的选项是
ArrayList
和Web服务我也使用ArrayList
类型的变量来保存此值,那么为什么会发生此错误?将参数发送到Web服务还是有其他方法?
在你的代码中ArrayList选项;应该像ArrayList options = new ArrayList(); – Satpal 2013-03-18 12:01:24