我有一个服务调用,它从 SAP Web 服务返回日期和时间作为字符串,我试图将这些字符串解析为本地模型中的日期时间对象。
到目前为止,我已经取消了该方法,但我注意到的第一件事是编译器抱怨它无法将日期转换为它不是委托类型。
错误
错误 1 Lambda 表达式无法转换为“日期”,因为“日期”不是委托类型。C:\Users\phil.murray\Desktop\SAP 订单测试\WindowsApplication1\Form1.vb 43 57 WindowsApplication1
代码
_ordersProxy.Z_SPIN_ORDERS(_header, _order, _code)
Return From h In header.OrderBy(Function(w) w.AUFNR)
Select New Order With {.Aufnr = h.AUFNR, .BatchType = h.BATCH_TYPE,
.EngineType = h.ENGINE_TYPE, .ProgrammedQuantity = h.PROGRAMMED_QTY,
.StartDate = Function()
Dim startDate As DateTime
Dim startTime As DateTime
Date.TryParse(h.START_DATE, startDate)
Date.TryParse(h.START_TIME, startTime)
Return New DateTime(startDate.Year, startDate.Month, startDate.Day,
startTime.Hour, startTime.Minute, startTime.Second)
End Function}
局部模型
Public Class Order
Public Property Aufnr As String
Public Property EngineType As String
Public Property ProgrammedQuantity As Int16
Public Property BatchType As String
Public Property StartDate As DateTime
Public Property OrderParts As IList(Of Part)
Public Property OrderProcessCodes As IList(Of ProcessCode)
End Class
用 lambda 表达式解析这个字符串时我错过了什么?