Monday, 14 December 2015


                                 How to Set an empty DateTime variable ?

I would declare an empty String variable like this:
    string myString = string.Empty;
Is there an equivalent for a 'DateTime' variable ?
Answer :

Since DateTime is a value type you cannot assign null to it, but exactly for these cases (absence of a value) Nullable<T> was introduced - use a nullable DateTime instead:
DateTime? myTime = null;

No comments:

Post a Comment