How could i add (DateTime?) and (long?) in C#, where long is hrs.
Result expected in DateTime
How could i add (DateTime?) and (long?) in C#, where long is hrs. Result
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
** Nullable Version **
** Nullable Version (compact) **
** Nullable with if statement **
Follow up:
In the other answers, I liked the use of .Value (which looks a little cleaner than a cast), but this doesn’t remove the need to check for null in the hours parameter. btw: I tried one of the other .Value answers and got Argument 1: cannot convert from ‘long?’ to ‘double’ — i.e. you can’t forget the null check.