c# - Datetime? to string -
i need convert datetime?
string. ??
operator dosent work , calling tostring
on null
make things fall over. advice on how handle datetime?
thanks
below code context. o.customerrequireddate
datetime?
, predictedactivationdate
string
. both need stay datatype are.
{ rsp = (from r in db.btrequests join o in db.neworders on r.id equals o.requestid join s in db.status on r.status equals s.id.tostring() select new datalayer.orderresponse { requestid = requestid, message = s.statusdescription, orderstatus = r.status.tostring(), predictedactivationdate =r.status == "3" || r.status == "4" || r.status == "5" || r.status == "6" || r.status == "9" ? (o.customerrequireddate ?? ""): "" }).firstordefault();
you do
o.customerrequireddate.hasvalue ? o.customerrequireddate.value.tostring() : ""
Comments
Post a Comment