条件付き三項演算子でNothing(Of Double)を設定できないのはなぜですか?条件付き三項演算子でNullable(Of)がNothingに設定されていません
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?))
http://stackoverflow.com/a/ 1828205/1070452 – Plutonix
'Option Strict On'は、このような状況でより速くフィードバックを提供します。 – Fabio