我正在尝试在我的UI上设置日期范围过滤器,并带有复选框,说明是否应该使用DateTimePicker的值,例如
Dim fromDate As DateTime? = If(fromDatePicker.Checked, fromDatePicker.Value, Nothing)
Run Code Online (Sandbox Code Playgroud)
然而设置fromDate为Nothing不会导致设置为Nothing'12:00:00 AM',并且以下If语句错误地执行过滤器,因为startDate不是Nothing.
If (Not startDate Is Nothing) Then
list = list.Where(Function(i) i.InvDate.Value >= startDate.Value)
End If
Run Code Online (Sandbox Code Playgroud)
我如何真正确保startDate获得价值Nothing?