c# - How to convert nullable DateTime? -
string fc = ....... dictionary<string, string> fcdata = serializer.deserialize<dictionary<string, string>>(fc); if (!string.isnullorwhitespace(fcdata["diploma.graduationbegindate"])) datetime? graduationbegindate = convert.todatetime(fcdata["diploma.graduationbegindate"]); error : {"object reference not set instance of object."}
this code . fcdata has value, count =11 , fcdata["diploma.graduationbegindate"] value 10.05.2016 why doesn't work ? me ?
you can affect datetime datetime? :
datetime t1 = somedate; datetime? t2; t2 = t1; <- works in contrary :
datetime? t1 = somedate; datetime t2; t2 = t1; <- won't work, need cast t2 = (datetime)t1; hope help.
Comments
Post a Comment