If I had a DateTime on a class called "TimeLastAccessed", would it make more sense for this DateTime to be nullable:
public DateTime? TimeLastAccessed { get; set }
if (TimeLastAccessed == null) // ... handle it
to indicate it has never been accessed or check for DateTime.MinValue
public DateTime TimeLastAccessed { get; set; }
if (TimeLastAccessed == DateTime.MinValue) // ... handle it
?
It makes more sense to use Nullable. That's the idea of Nullable - to express that a value type has no valid value. To use MinValue is a patch for cases you don't have Nullable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With