Set an empty DateTime variable

前端 未结 12 2038
走了就别回头了
走了就别回头了 2020-12-16 08:59

I would declare an empty String variable like this:

    string myString = string.Empty;

Is there an equivalent for a \'DateTime\' variable

12条回答
  •  一整个雨季
    2020-12-16 09:32

    This will work for null able dateTime parameter

    . .

    SearchUsingDate(DateTime? StartDate, DateTime? EndDate){
         DateTime LastDate;
         if (EndDate != null)
           {
              LastDate = (DateTime)EndDate;
              LastDate = LastDate.AddDays(1);
              EndDate = LastDate;
            }
    }
    

提交回复
热议问题