I’m trying to compare two variables of type nullable(of boolean) in VB.NET 2010. One of the variables has a value False and the other is Nothing. Now I was expecting the following expression to evaluate to true, but this is not the case:
Dim var1 as nullable(of boolean) = False
Dim var2 as nullable(of boolean)
var2 = Nothing
If var1 <> var2 Then
msgbox "they are different"
End If
Why don’t I see my MsgBox? How should I compare two nullables (of boolean)?
You can use
Nullable.Equals: