.net - Parse strings into datetime in Lambda expression -
i have service call returning date , time strings sap web service , trying parse strings datetime object in local model.
so far have stubbed out method first thing noticed compiler complaining not convert date not delegate type.
error
error 1 lambda expression cannot converted 'date' because 'date' not 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 h in header.orderby(function(w) w.aufnr) select new order {.aufnr = h.aufnr, .batchtype = h.batch_type, .enginetype = h.engine_type, .programmedquantity = h.programmed_qty, .startdate = function() dim startdate datetime dim starttime 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 string public property enginetype string public property programmedquantity int16 public property batchtype string public property startdate datetime public property orderparts ilist(of part) public property orderprocesscodes ilist(of processcode) end class
what missing when parsing string lambda expression?
the problem startdate
presumably property of type datetime
- whereas lambda expression assignable func(of datetime)
.
you call lambda expression set startdate
, fundamentally if property of type datetime
, need give value of type, not function can executed obtain value.
of course, alternative (potentially) change startdate
property type. it's unclear you're trying @ moment, or kind of object you're setting property on.
Comments
Post a Comment