I have two DateTime variables of Nullable types.
DateTime? date1 = new DateTime(); DateTime? date2 = new DateTime();
I need to get the differe
If your goal is to return null when one (or both) of the dates is null, you can write like this (if you can use ? operator which is available in C# 6.0 compiler):
?
int? days = (int?) (date1 - date2)?.TotalDays;