To test nullable type variables for Nothing values, use the Is operator or the IsNot operator. : nullable « Language Basics « VB.Net






To test nullable type variables for Nothing values, use the Is operator or the IsNot operator.

  

Module Module1
    Sub Main()

        Dim n? As Integer

        Console.WriteLine(n Is Nothing)
        n = 4

        Console.WriteLine(n Is Nothing)
        n = Nothing

        Console.WriteLine(n IsNot Nothing)
    End Sub
End Module

   
    
  








Related examples in the same category

1.Check if nullable is null
2.Main with Nullable (Of T)