8
使用這些變量:'?'性格不能在這裏
Dim d1 As Date? = Nothing
Dim d2 As DateTime? = Nothing
Dim i1 As Integer? = Nothing
Dim i2 As Int32? = Nothing
我爲什麼允許這樣做?:
Dim flag1 As Boolean = Date?.Equals(d1, d2)
Dim flag2 As Boolean = Integer?.Equals(i1, i2)
...但不允許這樣做?:
Dim flag3 As Boolean = DateTime?.Equals(d2, d1)
Dim flag4 As Boolean = Int32?.Equals(i2, i1)
最後一段代碼將失敗,並顯示一條錯誤消息:
'?'字符不能在這裏使用。
呵呵。編譯器錯誤。 –
任何人都可以重現嗎? –
Me @ VS 2010 SP1。 – Neolisk