The problem is that it Nothingworks differently in VB.NET than, for example, nullin C #. When Nothingused in the context of a value type (for example Integer), it represents the default value of that type. In this case, 0
In the first example, both branches of the ternary operator are valid Integer. The true branch represents 0, and the false branch represents 43.
Integer, VB.NET , Object, Integer.
, , , Integer?, Integer Object. :
dim val1 As Integer? = If(5 > 2, Nothing, New Integer?(43))
an Integer?, Nothing Integer.