The most maintainable way of representing a null value would be to use a Nullable<DateTime>
i.e. DateTime?
. That way the null value is clearly represented as a non-value instead of a magic value that needs special treatment.
(The null value of course also needs special treatment, but it's much harder to overlook.)
If you use a magic value to represent null values, no value is much better than any other. You can use DateTime.MinValue
or new DateTime()
(which give the same result), or you can use any arbitrary value that is outside the range that your application is using.
A value like DateTime.MinValue has a slight advantage as it's already defined as a constant, on the other hand you can define your own constant that has a slightly better name, for example:
public const DateTime DateThatMeansNull = new DateTime(1685, 3, 21);