Assigning result of If operator to System.Nullable type
问题 When using the If operator (http://msdn.microsoft.com/en-us/library/bb513985(v=VS.100).aspx) to assign a value to a System.Nullable object, if the result is Nothing (null), then 0 is assigned to the object. Example: 'Expected value is null (Nothing). Actual value assigned is 0. Dim x As System.Nullable(Of Integer) = If(1 = 0, 1, Nothing) If x is a nullable type, why is it being assigned the default integer type of 0. Shouldn't it receive a value of null? 回答1: Nothing in the context of a value