我在我的服務器和我的Web服務上有相同的類。 我有以下的WebMethod:無法將列表<T>轉移到網絡服務?
[WebMethod]
public int CreateOrder(List<Purchase> p, string username)
{
o.Add(new Order(p,username));
return o.Count;
}
但是下面的代碼,在服務器上運行:
protected void CartRepeater_ItemCommand(object source, RepeaterCommandEventArgs e)
{
List<Purchase> l = ((List<Purchase>)Session["Cart"]);
if (e.CommandName == "Order")
{
localhost.ValidateService WS = new localhost.ValidateService();
WS.CreateOrder(l, Session["username"].ToString());
}
}
提供了以下錯誤:Argument '1': cannot convert from 'System.Collections.Generic.List<Purchase>' to 'localhost.Purchase[]'
。
如何將list<Purchase>
對象轉移到Web服務?
仍然沒有運氣。錯誤是'Argument'1':無法從'Purchase []'轉換爲'localhost.Purchase []'' – iTayb 2010-04-13 10:00:56
@iTayb'Purchase'!='localhost.Purchase' – mxmissile 2010-04-13 10:17:15
我怎樣才能使用其中的一個?他們不在同一臺服務器上。 – iTayb 2010-04-13 10:20:13