I have a service call that is returning the date and time as strings from a SAP web service and I am trying to parse those strings into a datetime object in the local model.
So far I have stubbed out the method but the first thing I noticed was the compiler complaining that it could not convert the date as its not a delegate type.
Error
Error 1 Lambda expression cannot be converted to 'Date' because 'Date' is not a delegate type. C:\Users\phil.murray\Desktop\SAP Orders Test\WindowsApplication1\Form1.vb 43 57 WindowsApplication1
Code
_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}
Local Model
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
What am I missing when parsing this string with a lambda expression?