System.DateTime? vs System.DateTime

后端 未结 6 1085
心在旅途
心在旅途 2021-02-05 02:53

I was writing to some code where I needed to read the date value from a Calendar control in my page (Ajax toolkit: calendar extender).

The code below:

6条回答
  •  春和景丽
    2021-02-05 03:42

    A much better solution and IMO the best feature of all with the nullable class

    DateTime newSelectedDate = myCalendarExtender.SelectedDate.GetValueOrDefault();
    

提交回复
热议问题