为什么我不能通过条件三元运算符将 Nothing 设置为 Nullable(Of Double) 但我可以直接设置?
Dim d As Double? = Nothing
d = If(True, 0, Nothing) ' result: d = 0
d = Nothing ' result: d = Nothing
d = If(False, 0, Nothing) ' result: d = 0 Why?
编辑:这些工作(基于以下接受的答案):
d = If(False, 0, New Integer?)
d = If(False, CType(0, Double?), Nothing)
d = If(False, 0, CType(Nothing, Double?))