开发者

ASP.NET Cast ArrayList of objects to custom Objects

Hey Just getting the following error

Unable to cast object o开发者_StackOverflowf type 'System.Object[]' to type 'OrderService.webdirect_WebLinesRow[]'.

On the line

webdirect(web_companyID, web_locationCode, web_customerNumber, web_orderNumber, web_orderReference, web_orderDate, webLinesArray.ToArray(), o_Company, o_LocationCode, o_CustomerNumber, o_OrderNumber, o_OrderStatus, o_OrdDescrip, webRespArray)

I created the webLinesArray.ToArray() array as such

Dim webLinesArray As New ArrayList()

Am I missing an additional cast or something ?


Try out using System.Linq:

webLinesArray.Cast(of WebLinesRow)().ToArray()

instead of

webLinesArray.ToArray()

BTW,

why are you using legacy ArrayList? Try out generic List<T>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜